(* Content-type: application/mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 6.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       145,          7]
NotebookDataLength[    118817,       3232]
NotebookOptionsPosition[    112636,       3007]
NotebookOutlinePosition[    113113,       3027]
CellTagsIndexPosition[    113070,       3024]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell[BoxData[
 RowBox[{
  RowBox[{"(*", 
   RowBox[{
    RowBox[{"DataAcquisition", ".", 
     RowBox[{"m", " ", "--"}]}], "A", " ", "package", " ", "for", " ", 
    "calling", " ", "C", " ", "functions", " ", "that", " ", "control", " ", 
    "a", " ", "National", " ", "Instruments", " ", "data", " ", "acquisition",
     " ", "card"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", 
  RowBox[{
  "BeginPackage", "[", "\"\<DAQ`DataAcquisition`\>\"", "]"}]}]], "Input",
 InitializationCell->True,
 CellChangeTimes->{{3.4094513396149087`*^9, 3.4094513437308273`*^9}, 
   3.4094516930431137`*^9, {3.4094521844296927`*^9, 3.409452184850298*^9}, {
   3.4094923756102495`*^9, 3.4094923779836626`*^9}, 3.4094925181852627`*^9, {
   3.4094963348032894`*^9, 3.4094963371066017`*^9}}],

Cell[CellGroupData[{

Cell["Usage strings and default options:", "Subtitle",
 CellDingbat->"\[FilledSquare]",
 InitializationCell->True],

Cell[BoxData[{
 StyleBox[
  RowBox[{
   RowBox[{"DataAcquisition", "::", "usage"}], "=", 
   "\"\<DataAcquisition is a package that calls mathlinked C commands for a \
National Instruments data acquisition card. Functions are available for both \
input and output. They include GetVoltages, GetVoltagesTrig, \
GetVoltagesDigTrig, OutputVoltage, and OutputWaveform.\>\""}],
  FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{"GetVoltages", "::", "usage"}], "=", 
   "\"\<GetVoltages[channel list, sampling frequency, number of samples per \
channel] is a function that returns a list of voltages as read by the NIDAQ \
card. The channel must be a one dimensional list, frequency a real number, \
and number of samples an integer.\>\""}],
  FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{
    RowBox[{"Options", "[", "GetVoltages", "]"}], "=", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"Global`Device", "->", "1"}], ",", 
      RowBox[{"Global`TerminalMode", "\[Rule]", "Global`Differential"}], ",", 
      
      RowBox[{"Global`MinValue", "\[Rule]", 
       RowBox[{"-", "10"}]}], ",", 
      RowBox[{"Global`MaxValue", "\[Rule]", "10"}], ",", 
      RowBox[{"Global`Units", "\[Rule]", "Global`Volts"}], ",", 
      RowBox[{"Global`ClockSource", "\[Rule]", "Global`OnboardClock"}], ",", 
      RowBox[{"Global`ActiveEdge", "\[Rule]", "Global`Rising"}], ",", 
      RowBox[{"Global`SampleMode", "\[Rule]", "Global`Finite"}], ",", 
      RowBox[{"Global`TimeOut", "\[Rule]", "10"}], ",", 
      RowBox[{"Global`MessageLevel", "\[Rule]", "0"}], ",", 
      RowBox[{"Global`IncludeTime", "->", "Global`Include"}], ",", 
      RowBox[{"Global`SetupOnly", "\[Rule]", "False"}], ",", 
      RowBox[{"Global`TransferMechanism", "\[Rule]", "Global`Interrupts"}]}], 
     "}"}]}], ";"}],
  FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{"GetVoltagesTrig", "::", "usage"}], "=", 
   "\"\<GetVoltagesTrig[channel list, sampling frequency, number of samples \
per channel,trig channel,trigger level] is a function that records voltages \
on input channels at specified frequency after receiving an analog trigger of \
correct magnitude on trigger channel. The channel list must be a one \
dimensional list, frequency a real number,number of samples an integer, \
trigchannel an integer, and trig level a real number.\>\""}],
  FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{
    RowBox[{"Options", "[", "GetVoltagesTrig", "]"}], "=", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"Global`Device", "\[Rule]", "1"}], ",", 
      RowBox[{"Global`TerminalMode", "\[Rule]", "Global`Differential"}], ",", 
      
      RowBox[{"Global`MinValue", "\[Rule]", 
       RowBox[{"-", "10"}]}], ",", 
      RowBox[{"Global`MaxValue", "\[Rule]", "10"}], ",", 
      RowBox[{"Global`Units", "->", "Global`Volts"}], ",", 
      RowBox[{"Global`ClockSource", "->", "Global`OnboardClock"}], ",", 
      RowBox[{"Global`ActiveEdge", "->", "Global`Rising"}], ",", 
      RowBox[{"Global`SampleMode", "\[Rule]", "Global`Finite"}], ",", 
      RowBox[{"Global`TimeOut", "\[Rule]", "10"}], ",", 
      RowBox[{"Global`TriggerSlope", "\[Rule]", "Global`Rising"}], ",", 
      RowBox[{"Global`PreTriggerSamples", "\[Rule]", "0"}], ",", 
      RowBox[{"Global`MessageLevel", "\[Rule]", "0"}], ",", 
      RowBox[{"Global`IncludeTime", "->", "Global`Include"}], ",", 
      RowBox[{"Global`SetupOnly", "\[Rule]", "False"}], ",", 
      RowBox[{"Global`TransferMechanism", "\[Rule]", "Global`Interrupts"}]}], 
     "}"}]}], ";"}],
  FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{"GetVoltagesDigTrig", "::", "usage"}], "=", 
   "\"\<GetVoltagesDigTrig[channel list, sampling frequency, number of \
samples per channel,trigger channel] is a function that records voltages on \
input channels at specified frequency after receiving a digital edge on \
trigger channel. Channel list must be a one dimensional list, frequency a \
real number, number of samples an integer, and trigger channel an \
integer.\>\""}],
  FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{
    RowBox[{"Options", "[", "GetVoltagesDigTrig", "]"}], "=", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"Global`Device", "->", "1"}], ",", 
      RowBox[{"Global`TerminalMode", "\[Rule]", "Global`Differential"}], ",", 
      
      RowBox[{"Global`MinValue", "\[Rule]", 
       RowBox[{"-", "10"}]}], ",", 
      RowBox[{"Global`MaxValue", "\[Rule]", "10"}], ",", 
      RowBox[{"Global`Units", "\[Rule]", "Global`Volts"}], ",", 
      RowBox[{"Global`ClockSource", "\[Rule]", "Global`OnboardClock"}], ",", 
      RowBox[{"Global`ActiveEdge", "\[Rule]", "Global`Rising"}], ",", 
      RowBox[{"Global`SampleMode", "\[Rule]", "Global`Finite"}], ",", 
      RowBox[{"Global`TimeOut", "\[Rule]", "10"}], ",", 
      RowBox[{"Global`TriggerEdge", "\[Rule]", "Global`Rising"}], ",", 
      RowBox[{"Global`MessageLevel", "\[Rule]", "0"}], ",", 
      RowBox[{"Global`IncludeTime", "->", "Global`Include"}], ",", 
      RowBox[{"Global`TriggerSlope", "\[Rule]", "Global`Rising"}], ",", 
      RowBox[{"Global`PreTriggerSamples", "\[Rule]", "0"}], ",", 
      RowBox[{"Global`SetupOnly", "\[Rule]", "False"}], ",", 
      RowBox[{"Global`TransferMechanism", "\[Rule]", "Global`Interrupts"}]}], 
     "}"}]}], ";"}],
  FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{"OutputVoltage", "::", "usage"}], "=", 
   "\"\<OutputVoltage[channel list, voltage] is a function that outputs \
voltage on the specified channels. The function returns an integer that can \
be used with ClearTask to stop the task. The channel list must be one \
dimensional, and voltage must be a real number.\>\""}],
  FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{"Options", "[", "OutputVoltage", "]"}], "=", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"Global`Device", "\[Rule]", "1"}], ",", 
     RowBox[{"Global`MinValue", "\[Rule]", 
      RowBox[{"-", "10"}]}], ",", 
     RowBox[{"Global`MaxValue", "\[Rule]", "10"}], ",", 
     RowBox[{"Global`Units", "\[Rule]", "Global`Volts"}], ",", 
     RowBox[{"Global`TimeOut", "\[Rule]", "10"}], ",", 
     RowBox[{"Global`MessageLevel", "\[Rule]", "0"}], ",", 
     RowBox[{"Global`SetupOnly", "\[Rule]", "False"}], ",", 
     RowBox[{"Global`TransferMechanism", "\[Rule]", "Global`Interrupts"}], 
     ",", 
     RowBox[{"Global`ClockSource", "\[Rule]", "Global`OnboardClock"}]}], 
    "}"}]}],
  FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{"OutputWaveform", "::", "usage"}], "=", 
   "\"\<OutputWaveform[channel list, waveform, frequency of point output, \
number of periods] is a function that outputs the waveform list as voltages \
on listed channels at specified frequency for a certain number of periods. \
The function returns an integer that can be used with ClearTask to stop the \
output. For continuous output use the option SampleMode->Continuous. The \
channel list must be one dimensional, waveform a list of real numbers, \
frequency and number of periods must also be real numbers.\>\""}],
  FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{
    RowBox[{"Options", "[", "OutputWaveform", "]"}], "=", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"Global`Device", "\[Rule]", "1"}], ",", 
      RowBox[{"Global`MinValue", "\[Rule]", 
       RowBox[{"-", "10"}]}], ",", 
      RowBox[{"Global`MaxValue", "\[Rule]", "10"}], ",", 
      RowBox[{"Global`Units", "\[Rule]", "Global`Volts"}], ",", 
      RowBox[{"Global`ClockSource", "\[Rule]", "Global`OnboardClock"}], ",", 
      RowBox[{"Global`ActiveEdge", "\[Rule]", "Global`Rising"}], ",", 
      RowBox[{"Global`TransferMechanism", "->", "Global`Interrupts"}], ",", 
      RowBox[{"Global`SampleMode", "->", "Global`Finite"}], ",", 
      RowBox[{"Global`TimeOut", "\[Rule]", "10"}], ",", 
      RowBox[{"Global`MessageLevel", "\[Rule]", "0"}], ",", 
      RowBox[{"Global`SetupOnly", "\[Rule]", "False"}]}], "}"}]}], ";"}],
  FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{"ReDoLink", "::", "usage"}], "=", 
   "\"\<ReDoLink[] is a function that resets the Mathlink connection, or if \
no connection is currently open it establishes a connection.\>\""}],
  FontColor->GrayLevel[0]]}], "Input",
 InitializationCell->True,
 CellChangeTimes->{{3.409500126906066*^9, 3.40950012725657*^9}, {
  3.4095001698177695`*^9, 3.409500209394678*^9}}]
}, Closed]],

Cell[BoxData[
 RowBox[{"Begin", "[", "\"\<`Private`\>\"", "]"}]], "Input",
 InitializationCell->True],

Cell[CellGroupData[{

Cell["Message Statements", "Subtitle",
 CellDingbat->"\[FilledSquare]",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{
  RowBox[{"messages", ":=", "\[IndentingNewLine]", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{
     "continuousmessage", ":=", 
      "\"\<When using the SampleMode->Continous mode the number of periods \
argument is ignored but still required as input. To stop a continuous \
waveform output you must clear the task using the ClearTask command and your \
task number. (To suppress this message use the MessageLevel->#<2 \
option.)\>\""}], ";", "\[IndentingNewLine]", 
     RowBox[{
     "setuponlymessage", ":=", 
      "\"\<When using the SetupOnly->True option you are returned an integer. \
 To complete the task use RunTask[] with that integer as an argument. That \
task is completed upon each evaluation of RunTask[].  You must clear the task \
using ClearTask[] with that integer as an argument in order to change the \
task.(To suppress this message use the MessageLevel->#<2 option.)\>\""}], ";",
      "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"outwaveflag", "===", "1"}], "&&", 
        RowBox[{"messagelevel", ">", "1"}], "&&", 
        RowBox[{"samplemode", "===", "Global`Continuous"}]}], ",", 
       RowBox[{
        RowBox[{"Print", "[", "continuousmessage", "]"}], ";"}], ",", 
       "Null"}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"setupflag", "===", "1"}], "&&", 
        RowBox[{"messagelevel", ">", "1"}]}], ",", 
       RowBox[{
        RowBox[{"Print", "[", "setuponlymessage", "]"}], ";"}], ",", "Null"}],
       "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"includetimeflag", "===", "1"}], "&&", 
        RowBox[{"messagelevel", ">", "1"}], "&&", 
        RowBox[{"setupflag", "===", "0"}]}], ",", 
       RowBox[{
        RowBox[{
        "Print", "[", "\"\<Your units are {seconds,volts}.\>\"", "]"}], ";"}],
        ",", "Null"}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"includetimeflag", "===", "0"}], "&&", 
        RowBox[{"messagelevel", ">", "1"}], "&&", 
        RowBox[{"setupflag", "===", "0"}]}], ",", 
       RowBox[{
        RowBox[{"Print", "[", "\"\<Your units are {volts}.\>\"", "]"}], ";"}],
        ",", "Null"}], "]"}], ";"}], ")"}]}], ";"}]], "Input",
 InitializationCell->True]
}, Closed]],

Cell[CellGroupData[{

Cell["Argument and Option tests", "Subtitle",
 CellDingbat->"\[FilledSquare]",
 InitializationCell->True],

Cell[CellGroupData[{

Cell["argumenttests and optiontests definitions", "Subsubtitle",
 InitializationCell->True],

Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{"argumenttests", ":=", 
    RowBox[{"(", 
     RowBox[{
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"ValueQ", "[", "chan", "]"}], ",", 
        RowBox[{"samplechanneltest", ";"}], ",", "Null"}], "]"}], ";", 
      "\[IndentingNewLine]", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"ValueQ", "[", "freq", "]"}], ",", "frequencytest", ",", 
        "Null"}], "]"}], ";", "\[IndentingNewLine]", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"ValueQ", "[", "samples", "]"}], ",", "samplestest", ",", 
        "Null"}], "]"}], ";", "\[IndentingNewLine]", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"ValueQ", "[", "trigchannel", "]"}], ",", 
        "triggerchanneltest", ",", "Null"}], "]"}], ";", 
      "\[IndentingNewLine]", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"ValueQ", "[", "triglevel", "]"}], ",", "triggerleveltest", 
        ",", "Null"}], "]"}], ";", "\[IndentingNewLine]", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"ValueQ", "[", "wavechan", "]"}], ",", 
        RowBox[{"waveformchanneltest", ";", "waveformtest", ";"}], ",", 
        "Null"}], "]"}], ";", "\[IndentingNewLine]", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"ValueQ", "[", "periods", "]"}], ",", "periodstest", ",", 
        "Null"}], "]"}], ";"}], ")"}]}], ";"}], 
  "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"optiontests", ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "device", "]"}], ",", 
       RowBox[{"devicetest", "[", "device", "]"}], ",", "Null"}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "terminalmode", "]"}], ",", 
       RowBox[{"terminaltest", "[", "terminalmode", "]"}], ",", "Null"}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"ValueQ", "[", "minvalue", "]"}], "&&", 
        RowBox[{"ValueQ", "[", "maxvalue", "]"}]}], ",", 
       RowBox[{"voltagetest", "[", 
        RowBox[{"minvalue", ",", "maxvalue"}], "]"}], ",", "Null"}], "]"}], 
     ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "units", "]"}], ",", 
       RowBox[{"unitstest", "[", "units", "]"}], ",", "Null"}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "clocksource", "]"}], ",", "clocksourcetest", 
       ",", "Null"}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "activeedge", "]"}], ",", "activeedgetest", ",",
        "Null"}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "samplemode", "]"}], ",", "samplemodetest", ",",
        "Null"}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "timeout", "]"}], ",", "timeouttest", ",", 
       "Null"}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "messagelevel", "]"}], ",", 
       "messageleveltest"}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "includetime", "]"}], ",", "includetimetest", 
       ",", "Null"}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "triggerslope", "]"}], ",", "triggerslopetest", 
       ",", "Null"}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "pretriggersamples", "]"}], ",", 
       "pretriggertest", ",", "Null"}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "transfermechanism", "]"}], ",", 
       "transfermechanismtest", ",", "Null"}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"ValueQ", "[", "setuponly", "]"}], ",", "setuptest", ",", 
       "Null"}], "]"}]}], ")"}]}], ";"}]}], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE CHANNEL ARGUMENT", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{"samplechanneltest", ":=", 
  RowBox[{"(", 
   RowBox[{
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Head", "[", "chan", "]"}], "===", "List"}], "&&", 
       RowBox[{
        RowBox[{"Depth", "[", "chan", "]"}], "===", "2"}]}], ",", "Null", ",", 
      RowBox[{
       RowBox[{
       "error", "=", 
        "\"\<Error: Channel list argument must be specified as a one \
dimensional list of integers.\>\""}], ";", 
       RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";", 
    "\[IndentingNewLine]", 
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Length", "[", 
         RowBox[{"Select", "[", 
          RowBox[{"chan", ",", 
           RowBox[{
            RowBox[{"#", ">", "7"}], "&"}]}], "]"}], "]"}], ">", "0"}], "&&", 
       
       RowBox[{"(", 
        RowBox[{
         RowBox[{"terminalmode", "===", "Global`Differential"}], "||", 
         RowBox[{"terminalmode", "===", "Global`DAQDefault"}]}], ")"}]}], ",", 
      RowBox[{
       RowBox[{
       "error", "=", 
        "\"\<Error: Channel argument out of range (0 to 7) for Differential \
(or DAQDefault) terminal mode.\>\""}], ";", 
       RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
     "]"}], ";", "\[IndentingNewLine]", 
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Length", "[", 
         RowBox[{"Select", "[", 
          RowBox[{"chan", ",", 
           RowBox[{
            RowBox[{"#", ">", "15"}], "&"}]}], "]"}], "]"}], ">", "0"}], "&&", 
       RowBox[{"(", 
        RowBox[{
         RowBox[{"terminalmode", "===", "Global`NonRSE"}], "||", 
         RowBox[{"terminalmode", "===", "Global`RSE"}]}], ")"}]}], ",", 
      RowBox[{
       RowBox[{
       "error", "=", 
        "\"\<Error: Channel list argument out of range (0 to 15) for single \
ended terminal mode.\>\""}], ";", 
       RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
     "]"}], ";", "\[IndentingNewLine]", 
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Length", "[", 
         RowBox[{"Select", "[", 
          RowBox[{"chan", ",", "IntegerQ"}], "]"}], "]"}], "<", 
        RowBox[{"Length", "[", "chan", "]"}]}], "||", 
       RowBox[{
        RowBox[{"Length", "[", 
         RowBox[{"Select", "[", 
          RowBox[{"chan", ",", "NonNegative"}], "]"}], "]"}], "<", 
        RowBox[{"Length", "[", "chan", "]"}]}]}], ",", 
      RowBox[{
       RowBox[{
       "error", "=", 
        "\"\<Error: The channel list argument must contain only non-negative \
integers.\>\""}], ";", 
       RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
     "]"}], ";"}], ")"}]}]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE WAVEFORM CHANNEL ARGUMENT", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{
  StyleBox["waveformchanneltest",
   FontColor->GrayLevel[0]], ":=", 
  StyleBox[
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Head", "[", "wavechan", "]"}], "===", "List"}], ",", "Null", 
       ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: Channel list argument must be a list.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}]}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"Union", "[", "wavechan", "]"}], "===", 
         RowBox[{"{", "0", "}"}]}], "||", 
        RowBox[{
         RowBox[{"Union", "[", "wavechan", "]"}], "===", 
         RowBox[{"{", "1", "}"}]}], "||", 
        RowBox[{
         RowBox[{"Union", "[", "wavechan", "]"}], "===", 
         RowBox[{"{", 
          RowBox[{"0", ",", "1"}], "}"}]}]}], ",", "Null", ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: The union of the channel argument must be one of the \
elements in the following list {{0},{1},{0,1}}.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"outwaveflag", "===", "1"}], "&&", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{
           RowBox[{"Length", "[", 
            RowBox[{"Union", "[", "wavechan", "]"}], "]"}], "===", "1"}], "&&", 
          RowBox[{
           RowBox[{"Depth", "[", 
            RowBox[{"wave", "//", "N"}], "]"}], "=!=", "2"}]}], ")"}]}], ",", 
       
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: When using a single channel, the waveform list must be \
one dimensional.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"outwaveflag", "===", "1"}], "&&", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{
           RowBox[{"Length", "[", 
            RowBox[{"Union", "[", "wavechan", "]"}], "]"}], "===", "2"}], "&&", 
          RowBox[{
           RowBox[{"Depth", "[", 
            RowBox[{"wave", "//", "N"}], "]"}], "=!=", "2"}], "&&", 
          RowBox[{
           RowBox[{"Depth", "[", 
            RowBox[{"wave", "//", "N"}], "]"}], "=!=", "3"}]}], ")"}]}], ",", 
       
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: When using both channels the Waveform argument must be a \
list of depth 2 or 3 (either a one dimensional  list {} or a list of two one \
dimensional lists {{},{}}.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"outwaveflag", "===", "1"}], "&&", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{
           RowBox[{"Head", "[", "wavechan", "]"}], "===", "List"}], "&&", 
          RowBox[{
           RowBox[{"Length", "[", 
            RowBox[{"Union", "[", "wavechan", "]"}], "]"}], "===", "2"}], "&&", 
          RowBox[{
           RowBox[{"Depth", "[", 
            RowBox[{"wave", "//", "N"}], "]"}], "===", "3"}], "&&", 
          RowBox[{"(", 
           RowBox[{
            RowBox[{
             RowBox[{"Length", "[", 
              RowBox[{"wave", "[", 
               RowBox[{"[", "1", "]"}], "]"}], "]"}], "=!=", 
             RowBox[{"Length", "[", 
              RowBox[{"wave", "[", 
               RowBox[{"[", "2", "]"}], "]"}], "]"}]}], "||", 
            RowBox[{
             RowBox[{"Length", "[", "wave", "]"}], ">", "2"}]}], ")"}]}], 
         ")"}]}], ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<When both channels are used and the waveform argument is a list \
of two lists, the two elements of waveform must be of equal length.\>\""}], 
        ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";"}], ")"}],
   FontColor->GrayLevel[0]]}]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE FREQUENCY ARGUMENT", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{
  StyleBox["frequencytest",
   FontColor->GrayLevel[0]], ":=", 
  RowBox[{
   StyleBox["(",
    FontColor->GrayLevel[0]], 
   StyleBox[
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"Head", "[", "freq", "]"}], "=!=", "Symbol"}], "&&", 
        RowBox[{"Element", "[", 
         RowBox[{"freq", ",", "Reals"}], "]"}], "&&", 
        RowBox[{"Positive", "[", "freq", "]"}], "&&", 
        RowBox[{"freq", "<=", "140000"}]}], ",", "Null", ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: Frequency must be a positive real number less than or \
equal to 140,000.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";"}],
    FontColor->GrayLevel[0]], ")"}]}]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE NUMBER OF SAMPLES PER CHANNEL ARGUMENT", "Text",
 InitializationCell->True],

Cell[BoxData[
 StyleBox[
  RowBox[{"samplestest", ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"Head", "[", "samples", "]"}], "=!=", "Symbol"}], "&&", 
        RowBox[{"Element", "[", 
         RowBox[{"samples", ",", "Integers"}], "]"}], "&&", 
        RowBox[{"Positive", "[", "samples", "]"}], "&&", 
        RowBox[{"samples", "<=", "100000"}]}], ",", "Null", ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: Number of Samples argument must be a positive integer \
less than or equal to 100,000.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";"}], 
    ")"}]}],
  FontColor->GrayLevel[0]]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE TRIGGER LEVEL ARGUMENT", "Text",
 InitializationCell->True],

Cell[BoxData[
 StyleBox[
  RowBox[{"triggerleveltest", ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"(", 
         RowBox[{"minvalue", "<=", "triglevel", "<=", "maxvalue"}], ")"}], "&&", 
        RowBox[{"Element", "[", 
         RowBox[{"triglevel", ",", "Reals"}], "]"}], "&&", 
        RowBox[{
         RowBox[{"Head", "[", "triglevel", "]"}], "=!=", "Symbol"}]}], ",", 
       "Null", ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: Trigger level must be a real number between MinValue and \
MaxValue\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";"}], 
    ")"}]}],
  FontColor->GrayLevel[0]]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE TRIGGER CHANNEL ARGUMENT", "Text",
 InitializationCell->True],

Cell[BoxData[
 StyleBox[
  RowBox[{"triggerchanneltest", ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"Head", "[", "trigchannel", "]"}], "===", "Integer"}], "&&", 
        
        RowBox[{"trigchannel", "\[GreaterEqual]", "0"}], "&&", 
        RowBox[{"trigchannel", "\[LessEqual]", "9"}]}], ",", "Null", ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: Trigger channel argument must be an integer in the range \
(inclusive) 0 to 9.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";"}], 
    ")"}]}],
  FontColor->GrayLevel[0]]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE WAVEFORM ARGUMENT", "Text",
 InitializationCell->True],

Cell[BoxData[
 StyleBox[
  RowBox[{"waveformtest", ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Head", "[", "wave", "]"}], "===", "List"}], ",", "Null", ",", 
       RowBox[{
        RowBox[{
        "error", "=", "\"\<Error:The Waveform argument must be a list.\>\""}],
         ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"outputflag", "===", "1"}], "&&", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{"!", 
           RowBox[{"Element", "[", 
            RowBox[{
             RowBox[{"wave", "[", 
              RowBox[{"[", "1", "]"}], "]"}], ",", "Reals"}], "]"}]}], "||", 
          RowBox[{
           RowBox[{"wave", "[", 
            RowBox[{"[", "1", "]"}], "]"}], "<", "minvalue"}], "||", 
          RowBox[{
           RowBox[{"wave", "[", 
            RowBox[{"[", "1", "]"}], "]"}], ">", "maxvalue"}]}], ")"}]}], ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error:The voltage argument must be a real number between \
MinValue and MaxValue (defaults are-10 and+10 respectively).\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"outputflag", "===", "1"}], "&&", 
        RowBox[{
         RowBox[{"Head", "[", 
          RowBox[{
           RowBox[{"wave", "[", 
            RowBox[{"[", "1", "]"}], "]"}], "//", "N"}], "]"}], "=!=", 
         "Real"}]}], ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error:The voltage argument must be a real number.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Length", "[", 
         RowBox[{"Select", "[", 
          RowBox[{
           RowBox[{"Join", "[", 
            RowBox[{"Flatten", "[", "wave", "]"}], "]"}], ",", "realtest"}], 
          "]"}], "]"}], "<", 
        RowBox[{"Length", "[", 
         RowBox[{"Join", "[", 
          RowBox[{"Flatten", "[", "wave", "]"}], "]"}], "]"}]}], ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error:All of the elements of the argument Waveform (list) must \
be real numbers.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"Length", "[", 
          RowBox[{"Select", "[", 
           RowBox[{
            RowBox[{"Join", "[", 
             RowBox[{"Flatten", "[", "wave", "]"}], "]"}], ",", 
            RowBox[{
             RowBox[{"#", ">", "maxvalue"}], "&"}]}], "]"}], "]"}], ">", 
         "0"}], "||", 
        RowBox[{
         RowBox[{"Length", "[", 
          RowBox[{"Select", "[", 
           RowBox[{
            RowBox[{"Join", "[", 
             RowBox[{"Flatten", "[", "wave", "]"}], "]"}], ",", 
            RowBox[{
             RowBox[{"#", "<", "minvalue"}], "&"}]}], "]"}], "]"}], ">", 
         "0"}]}], ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: All elements of the Waveform argument list must be \
within the range of MinValue to MaxValue (defaults are -10 and +10 \
respectively).\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";"}], ")"}]}],
  FontColor->GrayLevel[0]]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE NUMBER OF PERIODS ARGUMENT", "Text",
 InitializationCell->True],

Cell[BoxData[
 StyleBox[
  RowBox[{
   RowBox[{"periodstest", ":=", 
    RowBox[{"(", 
     RowBox[{
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{
         RowBox[{"(", 
          RowBox[{
           RowBox[{"!", 
            RowBox[{"Element", "[", 
             RowBox[{"periods", ",", "Reals"}], "]"}]}], "||", 
           RowBox[{"!", 
            RowBox[{"(", 
             RowBox[{"periods", ">", "0"}], ")"}]}], "||", 
           RowBox[{
            RowBox[{"Head", "[", "periods", "]"}], "===", "Symbol"}]}], ")"}],
          "&&", 
         RowBox[{"samplemode", "===", "Global`Finite"}]}], ",", 
        RowBox[{
         RowBox[{
         "error", "=", 
          "\"\<Error: Number of periods argument must be a positive real \
number.\>\""}], ";", 
         RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
       "]"}], ";"}], ")"}]}], ";"}],
  FontColor->GrayLevel[0]]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE DEVICE OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{
  StyleBox[
   RowBox[{"devicetest", ":=", 
    RowBox[{"(", 
     RowBox[{
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{
         RowBox[{"Element", "[", 
          RowBox[{"device", ",", "Integers"}], "]"}], "&&", 
         RowBox[{"device", ">=", "0"}], "&&", 
         RowBox[{
          RowBox[{"Head", "[", "device", "]"}], "=!=", "Symbol"}]}], ",", 
        "Null", ",", 
        RowBox[{
         RowBox[{
         "error", "=", 
          "\"\<Error: Device must be specified as an integer greater than or \
equal to zero.\>\""}], ";", 
         RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";"}], 
     ")"}]}],
   FontColor->GrayLevel[0]], ";"}]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE TERMINAL MODE OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 StyleBox[
  RowBox[{"terminaltest", ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"Head", "[", "terminalmode", "]"}], "=!=", "Symbol"}], "||", 
        
        RowBox[{"(", 
         RowBox[{
          RowBox[{
           RowBox[{"Head", "[", "terminalmode", "]"}], "===", "Symbol"}], "&&", 
          RowBox[{"terminalmode", "=!=", "Global`Differential"}], "&&", 
          RowBox[{"terminalmode", "=!=", "Global`RSE"}], "&&", 
          RowBox[{"terminalmode", "=!=", "Global`NonRSE"}], "&&", 
          RowBox[{"terminalmode", "=!=", "Global`DAQDefault"}]}], ")"}]}], 
       ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: Terminal Mode was not specified as \
DAQDefault,Differential, RSE, or NonRSE.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";"}], ")"}]}],
  FontColor->GrayLevel[0]]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE MINVALUE AND MAXVALUE OPTIONS", "Text",
 InitializationCell->True],

Cell[BoxData[
 StyleBox[
  RowBox[{"voltagetest", ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"minvalue", ">=", 
         RowBox[{"-", "10"}]}], "&&", 
        RowBox[{"Element", "[", 
         RowBox[{"minvalue", ",", "Reals"}], "]"}]}], ",", "Null", ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: MinValue should be a real number greater than or equal \
to -10 when using Units->Volts (default).\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"maxvalue", "<=", "10"}], "&&", 
        RowBox[{"Element", "[", 
         RowBox[{"maxvalue", ",", "Reals"}], "]"}]}], ",", "Null", ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: MaxValue should be a real number less than or equal to \
10 when using Units->Volts (default).\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"maxvalue", ">", "minvalue"}], ",", "Null", ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: MaxValue should be greater than MinValue\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"Head", "[", "minvalue", "]"}], "===", "Symbol"}], "||", 
        RowBox[{
         RowBox[{"Head", "[", "maxvalue", "]"}], "===", "Symbol"}]}], ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: MinValue and MaxValue must be specified as real numbers.\
\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";"}], ")"}]}],
  FontColor->GrayLevel[0]]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE UNITS OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{"unitstest", ":=", 
  RowBox[{"(", 
   RowBox[{
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Head", "[", "units", "]"}], "=!=", "Symbol"}], "||", 
       StyleBox[
        RowBox[{"(", 
         RowBox[{
          RowBox[{
           RowBox[{"Head", "[", "units", "]"}], "===", "Symbol"}], "&&", 
          RowBox[{"units", "=!=", "Global`Volts"}], "&&", 
          RowBox[{"Units", "=!=", "Global`CustomScale"}]}], ")"}],
        FontColor->GrayLevel[0]]}], 
      StyleBox[",",
       FontColor->GrayLevel[0]], 
      StyleBox[
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: Units was not specified as Volts or CustomScale.\>\""}], 
        ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}],
       FontColor->GrayLevel[0]], 
      StyleBox[",",
       FontColor->GrayLevel[0]], 
      StyleBox["Null",
       FontColor->GrayLevel[0]]}], 
     StyleBox["]",
      FontColor->GrayLevel[0]]}], 
    StyleBox[";",
     FontColor->GrayLevel[0]]}], 
   StyleBox[")",
    FontColor->GrayLevel[0]]}]}]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE CLOCK SOURCE OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{"clocksourcetest", ":=", 
  StyleBox[
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"Head", "[", "clocksource", "]"}], "=!=", "Symbol"}], "||", 
        RowBox[{"(", 
         RowBox[{"clocksource", "=!=", "Global`OnboardClock"}], ")"}]}], ",", 
       
       RowBox[{
        RowBox[{
        "error", "=", "\"\<Error: ClockSource should be OnboardClock.\>\""}], 
        ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";"}], ")"}],
   FontColor->GrayLevel[0]]}]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE ACTIVE EDGE OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{"activeedgetest", ":=", 
  StyleBox[
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"Head", "[", "activeedge", "]"}], "=!=", "Symbol"}], "||", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{
           RowBox[{"Head", "[", "activeedge", "]"}], "===", "Symbol"}], "&&", 
          
          RowBox[{"activeedge", "=!=", "Global`Rising"}], "&&", 
          RowBox[{"activeedge", "=!=", "Global`Falling"}]}], ")"}]}], ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: Active Edge was not specified as Rising or \
Falling.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";"}], ")"}],
   FontColor->GrayLevel[0]]}]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE SAMPLE MODE OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 StyleBox[
  RowBox[{"samplemodetest", ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"Head", "[", "samplemode", "]"}], "=!=", "Symbol"}], "||", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{
           RowBox[{"Head", "[", "samplemode", "]"}], "===", "Symbol"}], "&&", 
          
          RowBox[{"samplemode", "=!=", "Global`Finite"}], "&&", 
          RowBox[{"samplemode", "=!=", "Global`Continuous"}]}], ")"}]}], ",", 
       
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: SampleMode was not specified as Finite or \
Continuous.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";"}], ")"}]}],
  FontColor->GrayLevel[0]]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE TIME OUT OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{"timeouttest", ":=", 
  StyleBox[
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"(", 
         RowBox[{
          RowBox[{"!", 
           RowBox[{"Element", "[", 
            RowBox[{"timeout", ",", "Reals"}], "]"}]}], "||", 
          RowBox[{"!", 
           RowBox[{"Positive", "[", "timeout", "]"}]}]}], ")"}], "||", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{
           RowBox[{"Head", "[", "timeout", "]"}], "===", "Symbol"}], "&&", 
          RowBox[{"timeout", "=!=", "Global`WaitForever"}]}], ")"}]}], ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: TimeOut needs to be a positive real number or \
WaitForever.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";"}], ")"}],
   FontColor->GrayLevel[0]]}]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE MESSAGE LEVEL OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{"messageleveltest", ":=", 
  StyleBox[
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"Head", "[", "messagelevel", "]"}], "=!=", "Symbol"}], "&&", 
        
        RowBox[{"MemberQ", "[", 
         RowBox[{
          RowBox[{"{", 
           RowBox[{"0", ",", "1", ",", "2", ",", "3", ",", "4", ",", "5"}], 
           "}"}], ",", "messagelevel"}], "]"}]}], ",", "Null", ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: MessageLevel option was not specified as 0,1,2,3,4,or 5.\
\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";"}], 
    ")"}],
   FontColor->GrayLevel[0]]}]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE INCLUDE TIME OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{"includetimetest", ":=", 
  RowBox[{"(", 
   RowBox[{
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Head", "[", "includetime", "]"}], "===", "Symbol"}], "&&", 
       RowBox[{"includetime", "=!=", "Global`Include"}], "&&", 
       RowBox[{"includetime", "=!=", "Global`Omit"}]}], ",", 
      RowBox[{
       RowBox[{
       "error", "=", 
        "\"\<Error: IncludeTime option was not specified as Omit or \
Include.\>\""}], ";", 
       RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
     "]"}], ";", "\[IndentingNewLine]", 
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{"includetime", "===", "Global`Include"}], ",", 
      RowBox[{"includetimeflag", "=", "1"}], ",", 
      RowBox[{"includetimeflag", "=", "0"}]}], "]"}], ";"}], ")"}]}]], "Input",\

 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE TRIGGER SLOPE OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 StyleBox[
  RowBox[{"triggerslopetest", ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{
         RowBox[{"Head", "[", "triggerslope", "]"}], "=!=", "Symbol"}], "||", 
        
        RowBox[{"(", 
         RowBox[{
          RowBox[{
           RowBox[{"Head", "[", "triggerslope", "]"}], "===", "Symbol"}], "&&", 
          RowBox[{"triggerslope", "=!=", "Global`Rising"}], "&&", 
          RowBox[{"triggerslope", "=!=", "Global`Falling"}]}], ")"}]}], ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<Error: TriggerSlope option was not specified as Rising or \
Falling.\>\""}], ";", 
        RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
      "]"}], ";"}], ")"}]}],
  FontColor->GrayLevel[0]]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE TRANSFER MECHANISM OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{
  RowBox[{"transfermechanismtest", ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    StyleBox[
     RowBox[{
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{
         RowBox[{
          RowBox[{"Head", "[", "transfermechanism", "]"}], "=!=", "Symbol"}], 
         "||", 
         RowBox[{"(", 
          RowBox[{
           RowBox[{
            RowBox[{"Head", "[", "transfermechanism", "]"}], "===", 
            "Symbol"}], "&&", 
           RowBox[{"transfermechanism", "=!=", "Global`Interrupts"}], "&&", 
           RowBox[{"transfermechanism", "=!=", "Global`DMA"}]}], ")"}]}], ",", 
        RowBox[{
         RowBox[{
         "error", "=", 
          "\"\<Error: TransferMechanism option was not specified as \
Interrupts or DMA.\>\""}], ";", 
         RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}], ",", "Null"}], 
       "]"}], ";"}],
     FontColor->GrayLevel[0]], 
    StyleBox[")",
     FontColor->GrayLevel[0]]}]}], 
  StyleBox["\[IndentingNewLine]",
   FontColor->GrayLevel[0]]}]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE PRE TRIGGER SAMPLES OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{"pretriggertest", ":=", 
  RowBox[{"(", 
   RowBox[{
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Head", "[", "pretriggersamples", "]"}], "=!=", "Symbol"}], "&&", 
       RowBox[{"Element", "[", 
        RowBox[{"pretriggersamples", ",", "Reals"}], "]"}], "&&", 
       RowBox[{"pretriggersamples", "\[GreaterEqual]", "0"}]}], ",", "Null", 
      ",", 
      RowBox[{
       RowBox[{
       "error", "=", 
        "\"\<Error: PreTriggerSamples option must be specified (ruled) as a \
real number greater than or equal to zero.\>\""}], ";", 
       RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";", 
    "\[IndentingNewLine]", 
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{
       RowBox[{"Element", "[", 
        RowBox[{"pretriggersamples", ",", "Integers"}], "]"}], "&&", 
       RowBox[{"(", 
        RowBox[{
         RowBox[{"pretriggersamples", "+", "samples"}], "\[LessEqual]", 
         "100000"}], ")"}]}], ",", "Null", ",", 
      RowBox[{
       RowBox[{
       "error", "=", 
        "\"\<Error: The sum of the PreTriggerSamples option specification and \
the number of samples argument must be an integer less than or equal to \
100,000.\>\""}], ";", 
       RowBox[{"Goto", "[", "clearandabort", "]"}], ";"}]}], "]"}], ";"}], 
   ")"}]}]], "Input",
 InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["THE SETUP ONLY OPTION", "Text",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{
  RowBox[{
   StyleBox["setuptest",
    FontColor->GrayLevel[0]], ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"setuponly", "===", "True"}], "||", 
        RowBox[{"setuponly", "===", "False"}]}], ",", "Null", ",", 
       RowBox[{
        RowBox[{
        "error", "=", 
         "\"\<The SetupOnly option was not specified as True or False\>\""}], 
        ";", 
        RowBox[{"Goto", "[", " ", "clearandabort", "]"}], ";"}]}], "]"}], ";",
      "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"setuponly", "===", "True"}], ",", 
       RowBox[{"setupflag", "=", "1"}], ",", 
       RowBox[{"setupflag", "=", "0"}]}], "]"}], ";"}], ")"}]}], 
  ";"}]], "Input",
 InitializationCell->True,
 CellChangeTimes->{{3.4041539387479615`*^9, 3.4041539465992513`*^9}}]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Delayed Assignments for main functions", "Subtitle",
 CellDingbat->"\[FilledSquare]",
 InitializationCell->True],

Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{"setconstants", ":=", 
    RowBox[{"(", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"Global`DAQDefault", "=", "0"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`RSE", "=", "1"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`NonRSE", "=", "2"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`Differential", "=", "3"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`Rising", "=", "0"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`Falling", "=", "1"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`Volts", "=", "0"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`CustomScale", "=", "1"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`Finite", "=", "0"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`Continuous", "=", "1"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`WaitForever", "=", 
       RowBox[{"-", "1"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`Omit", "=", "0"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`Include", "=", "1"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`Interrupts", "=", "0"}], ";", "\[IndentingNewLine]", 
      RowBox[{"Global`DMA", "=", "1"}], ";"}], ")"}]}], ";"}], 
  " "}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"clearconstants", ":=", 
   RowBox[{
    StyleBox["Clear",
     FontColor->GrayLevel[0]], 
    StyleBox["[",
     FontColor->GrayLevel[0]], 
    StyleBox["\[IndentingNewLine]",
     FontColor->GrayLevel[0]], 
    RowBox[{
    "Global`DAQDefault", ",", "\[IndentingNewLine]", "Global`RSE", ",", 
     "\[IndentingNewLine]", "Global`NonRSE", ",", "\[IndentingNewLine]", 
     "Global`Differential", ",", "\[IndentingNewLine]", "Global`Rising", ",", 
     "\[IndentingNewLine]", "Global`Falling", ",", "\[IndentingNewLine]", 
     "Global`Volts", ",", "\[IndentingNewLine]", "Global`CustomScale", ",", 
     "\[IndentingNewLine]", "Global`Finite", ",", "\[IndentingNewLine]", 
     "Global`Continuous", ",", "\[IndentingNewLine]", "Global`WaitForever", 
     ",", "\[IndentingNewLine]", "Global`Omit", ",", "\[IndentingNewLine]", 
     "Global`Include", ",", "\[IndentingNewLine]", "Global`Interrupts", ",", 
     "\[IndentingNewLine]", "Global`DMA", ",", "\[IndentingNewLine]", 
     "outwaveflag", ",", "outputflag", ",", "includetimeflag", ",", 
     "\[IndentingNewLine]", "error", ",", "device", ",", "samplemode", ",", 
     "terminalmode", ",", "minvalue", ",", "maxvalue", ",", "units", ",", 
     "clocksource", ",", "activeedge", ",", "timeout", ",", "messagelevel", 
     ",", "includetime", ",", "triggerslope", ",", "pretriggersamples", ",", 
     "trigchannel", ",", "triglevel", ",", "wave", ",", "setupflag", ",", 
     "transfermechanism", ",", "setuponly", ",", "wavechan", ",", "freq", ",",
      "periods", ",", "chan", ",", "samples"}], "]"}]}], 
  ";"}], "\[IndentingNewLine]", 
 StyleBox[
  RowBox[{
   RowBox[{
    RowBox[{"UnsortedUnion", "[", "x_", "]"}], ":=", 
    RowBox[{"Module", "[", 
     RowBox[{
      RowBox[{"{", "f", "}"}], ",", 
      RowBox[{
       RowBox[{
        RowBox[{"f", "[", "y_", "]"}], ":=", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{
           RowBox[{"f", "[", "y", "]"}], "=", 
           RowBox[{"Sequence", "[", "]"}]}], ";", "y"}], ")"}]}], ";", 
       RowBox[{"f", "/@", "x"}]}]}], "]"}]}], ";"}],
  FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
 RowBox[{"getinputdevicestring", ":=", 
  RowBox[{"(", 
   RowBox[{
    RowBox[{"devicestring", "=", 
     RowBox[{"StringDrop", "[", 
      RowBox[{
       RowBox[{"StringDrop", "[", 
        RowBox[{
         RowBox[{"ToString", "[", 
          RowBox[{"ToString", "[", 
           RowBox[{"Table", "[", 
            RowBox[{
             RowBox[{"\"\<dev\>\"", "<>", 
              RowBox[{"ToString", "[", "device", "]"}], "<>", "\"\</ai\>\"", "<>", 
              RowBox[{"ToString", "[", 
               RowBox[{
                RowBox[{"UnsortedUnion", "[", "chan", "]"}], "[", 
                RowBox[{"[", "n", "]"}], "]"}], "]"}]}], ",", 
             RowBox[{"{", 
              RowBox[{"n", ",", "1", ",", "numberofchannels"}], "}"}]}], 
            "]"}], "]"}], "]"}], ",", "1"}], "]"}], ",", 
       RowBox[{"-", "1"}]}], "]"}]}], ";"}], ")"}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"getoutputdevicestring", ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"devicestring", "=", 
      RowBox[{"StringDrop", "[", 
       RowBox[{
        RowBox[{"StringDrop", "[", 
         RowBox[{
          RowBox[{"ToString", "[", 
           RowBox[{"ToString", "[", 
            RowBox[{"Table", "[", 
             RowBox[{
              RowBox[{"\"\<dev\>\"", "<>", 
               RowBox[{"ToString", "[", "device", "]"}], "<>", "\"\</ao\>\"", 
               "<>", 
               RowBox[{"ToString", "[", 
                RowBox[{
                 RowBox[{"UnsortedUnion", "[", "wavechan", "]"}], "[", 
                 RowBox[{"[", "n", "]"}], "]"}], "]"}]}], ",", 
              RowBox[{"{", 
               RowBox[{"n", ",", "1", ",", "numberofchannels"}], "}"}]}], 
             "]"}], "]"}], "]"}], ",", "1"}], "]"}], ",", 
        RowBox[{"-", "1"}]}], "]"}]}], ";"}], ")"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"getnumberofchannels", ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"outwaveflag", "===", "1"}], "||", 
        RowBox[{"outputflag", "===", "1"}]}], ",", 
       RowBox[{
        RowBox[{"numberofchannels", "=", 
         RowBox[{"Length", "[", 
          RowBox[{"Union", "[", "wavechan", "]"}], "]"}]}], ";"}], ",", 
       RowBox[{"numberofchannels", "=", 
        RowBox[{"Length", "[", 
         RowBox[{"Union", "[", "chan", "]"}], "]"}]}]}], "]"}], ";"}], 
    ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"getpostimelist", ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{
      StyleBox["If",
       FontColor->GrayLevel[0]], 
      StyleBox["[",
       FontColor->GrayLevel[0]], 
      RowBox[{
       RowBox[{
        RowBox[{"Head", "[", "listfromcall", "]"}], "===", "Integer"}], ",", 
       " ", 
       RowBox[{"Return", "[", "listfromcall", "]"}]}], "]"}], ";", " ", 
     RowBox[{"(*", " ", 
      RowBox[{"return", " ", "taskHandle"}], " ", "*)"}], 
     "\[IndentingNewLine]", 
     RowBox[{"postimelist", "=", 
      RowBox[{"Map", "[", 
       RowBox[{"N", ",", 
        RowBox[{"Table", "[", 
         RowBox[{"i", ",", 
          RowBox[{"{", 
           RowBox[{"i", ",", "0", ",", 
            RowBox[{
             RowBox[{"(", 
              RowBox[{"samples", "-", "1"}], ")"}], "/", "freq"}], ",", 
            RowBox[{"(", 
             RowBox[{"1", "/", "freq"}], ")"}]}], "}"}]}], "]"}]}], "]"}]}]}],
     ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"getnegtimelist", ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{
      StyleBox["If",
       FontColor->GrayLevel[0]], 
      StyleBox["[",
       FontColor->GrayLevel[0]], 
      RowBox[{
       RowBox[{
        RowBox[{"Head", "[", "listfromcall", "]"}], "===", "Integer"}], ",", 
       " ", 
       RowBox[{"Return", "[", "listfromcall", "]"}]}], "]"}], ";", " ", 
     RowBox[{"(*", " ", 
      RowBox[{"return", " ", "taskHandle"}], " ", "*)"}], 
     "\[IndentingNewLine]", 
     RowBox[{"negtimelist", "=", 
      RowBox[{"Map", "[", 
       RowBox[{"N", ",", 
        RowBox[{"Table", "[", 
         RowBox[{"i", ",", 
          RowBox[{"{", 
           RowBox[{"i", ",", 
            RowBox[{
             RowBox[{"-", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"Length", "[", 
                 RowBox[{"listfromcall", "[", 
                  RowBox[{"[", "1", "]"}], "]"}], "]"}], "/", 
                "numberofchannels"}], ")"}]}], "/", "freq"}], ",", 
            RowBox[{"0", "-", 
             RowBox[{"(", 
              RowBox[{"1", "/", "freq"}], ")"}]}], ",", 
            RowBox[{"(", 
             RowBox[{"1", "/", "freq"}], ")"}]}], "}"}]}], "]"}]}], "]"}]}]}],
     ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"getcompletelist", ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{
      StyleBox["If",
       FontColor->GrayLevel[0]], 
      StyleBox["[",
       FontColor->GrayLevel[0]], 
      RowBox[{
       RowBox[{
        RowBox[{"Head", "[", "listfromcall", "]"}], "===", "Integer"}], ",", 
       " ", 
       RowBox[{"Return", "[", "listfromcall", "]"}]}], "]"}], ";", " ", 
     RowBox[{"(*", " ", 
      RowBox[{"return", " ", "taskHandle"}], " ", "*)"}], 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"includetimeflag", "===", "1"}], "&&", 
        RowBox[{"numberofsamples", "=!=", "1"}]}], ",", 
       RowBox[{
        RowBox[{"newlist", "=", 
         RowBox[{"Table", "[", 
          RowBox[{
           RowBox[{"Transpose", "[", 
            RowBox[{"{", 
             RowBox[{"postimelist", ",", 
              RowBox[{"Take", "[", 
               RowBox[{"listfromcall", ",", 
                RowBox[{"{", 
                 RowBox[{"n", ",", 
                  RowBox[{"-", "1"}], ",", "numberofchannels"}], "}"}]}], 
               "]"}]}], "}"}], "]"}], ",", 
           RowBox[{"{", 
            RowBox[{"n", ",", "1", ",", "numberofchannels"}], "}"}]}], 
          "]"}]}], ";"}], ",", 
       RowBox[{
        RowBox[{"newlist", "=", 
         RowBox[{"Table", "[", 
          RowBox[{
           RowBox[{"Take", "[", 
            RowBox[{"listfromcall", ",", 
             RowBox[{"{", 
              RowBox[{"n", ",", 
               RowBox[{"-", "1"}], ",", "numberofchannels"}], "}"}]}], "]"}], 
           ",", 
           RowBox[{"{", 
            RowBox[{"n", ",", "1", ",", "numberofchannels"}], "}"}]}], 
          "]"}]}], ";"}]}], "]"}]}], ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"gettrigcompletelist", ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{
      StyleBox["If",
       FontColor->GrayLevel[0]], 
      StyleBox["[",
       FontColor->GrayLevel[0]], 
      RowBox[{
       RowBox[{
        RowBox[{"Head", "[", "listfromcall", "]"}], "===", "Integer"}], ",", 
       " ", 
       RowBox[{"Return", "[", "listfromcall", "]"}]}], "]"}], ";", " ", 
     RowBox[{"(*", " ", 
      RowBox[{"return", " ", "taskHandle"}], " ", "*)"}], 
     "\[IndentingNewLine]", 
     RowBox[{"timeslist", "=", 
      RowBox[{"Join", "[", 
       RowBox[{"negtimelist", ",", "postimelist"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"longlist", "=", 
      RowBox[{"Join", "[", 
       RowBox[{
        RowBox[{"listfromcall", "[", 
         RowBox[{"[", "1", "]"}], "]"}], ",", 
        RowBox[{"listfromcall", "[", 
         RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"includetimeflag", "===", "1"}], "&&", 
        RowBox[{"numberofsamples", "=!=", "1"}]}], ",", 
       RowBox[{
        RowBox[{"newlist", "=", 
         RowBox[{"Table", "[", 
          RowBox[{
           RowBox[{"Transpose", "[", 
            RowBox[{"{", 
             RowBox[{"timeslist", ",", 
              RowBox[{"Take", "[", 
               RowBox[{"longlist", ",", 
                RowBox[{"{", 
                 RowBox[{"n", ",", 
                  RowBox[{"-", "1"}], ",", "numberofchannels"}], "}"}]}], 
               "]"}]}], "}"}], "]"}], ",", 
           RowBox[{"{", 
            RowBox[{"n", ",", "1", ",", "numberofchannels"}], "}"}]}], 
          "]"}]}], ";"}], ",", 
       RowBox[{"newlist", "=", 
        RowBox[{"Table", "[", 
         RowBox[{
          RowBox[{"Take", "[", 
           RowBox[{"longlist", ",", 
            RowBox[{"{", 
             RowBox[{"n", ",", 
              RowBox[{"-", "1"}], ",", "numberofchannels"}], "}"}]}], "]"}], 
          ",", 
          RowBox[{"{", 
           RowBox[{"n", ",", "1", ",", "numberofchannels"}], "}"}]}], 
         "]"}]}]}], "]"}]}], ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"checksetuponly", ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{"(*", " ", 
     RowBox[{
      RowBox[{
      "This", " ", "function", " ", "needs", " ", "to", " ", "be", " ", 
       "changed", " ", "to", " ", "allowing", " ", "for", " ", "skipping", 
       " ", "following", " ", "commands", "\[IndentingNewLine]", 
       RowBox[{"Print", "[", 
        RowBox[{"\"\<head is :\>\"", ",", 
         RowBox[{"Head", "[", "listfromcall", "]"}]}], "]"}]}], ";"}], " ", 
     "*)"}], "\[IndentingNewLine]", 
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{
       RowBox[{"Head", "[", "listfromcall", "]"}], "===", "Integer"}], ",", 
      RowBox[{"clearconstants", ";", 
       RowBox[{"Return", "[", "listfromcall", "]"}]}], ",", "Null"}], "]"}], 
    ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   StyleBox["getnewlistfromcall",
    FontColor->GrayLevel[0]], 
   StyleBox[":=",
    FontColor->GrayLevel[0]], 
   RowBox[{
    StyleBox["(",
     FontColor->GrayLevel[0]], 
    StyleBox["\[IndentingNewLine]",
     FontColor->GrayLevel[0]], 
    StyleBox[
     RowBox[{"(*", " ", 
      RowBox[{
       RowBox[{"Print", "[", 
        RowBox[{
        "\"\<Setup only is\>\"", ",", "setuponly", ",", 
         "\"\<numchannels is: \>\"", ",", "numberofchannels"}], " ", "]"}], 
       ";"}], " ", "*)"}],
     FontColor->GrayLevel[0]], 
    StyleBox["\[IndentingNewLine]",
     FontColor->GrayLevel[0]], 
    RowBox[{
     RowBox[{
      StyleBox["If",
       FontColor->GrayLevel[0]], 
      StyleBox["[",
       FontColor->GrayLevel[0]], 
      RowBox[{
       RowBox[{
        RowBox[{"Head", "[", "listfromcall", "]"}], "===", "Integer"}], ",", 
       " ", 
       RowBox[{"Return", "[", 
        RowBox[{"newlistfromcall", "=", "listfromcall"}], "]"}]}], "]"}], ";",
      " ", 
     RowBox[{"(*", " ", 
      RowBox[{"return", " ", "taskHandle"}], " ", "*)"}], 
     StyleBox["\[IndentingNewLine]",
      FontColor->GrayLevel[0]], 
     StyleBox[
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"numberofchannels", "===", "1"}], ",", 
        RowBox[{"newlistfromcall", "=", 
         RowBox[{"Flatten", "[", 
          RowBox[{"newlist", ",", "1"}], "]"}]}], ",", 
        RowBox[{"newlistfromcall", "=", "newlist"}]}], "]"}],
      FontColor->GrayLevel[0]], 
     StyleBox[";",
      FontColor->GrayLevel[0]], 
     StyleBox["\[IndentingNewLine]",
      FontColor->GrayLevel[0]], 
     StyleBox["newlistfromcall",
      FontColor->GrayLevel[0]]}], 
    StyleBox[")",
     FontColor->GrayLevel[0]]}]}], 
  StyleBox[";",
   FontColor->GrayLevel[0]]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"realtest", "[", "x_", "]"}], ":=", 
   RowBox[{"Simplify", "[", 
    RowBox[{"x", "\[Element]", "Reals"}], "]"}]}], ";"}]}], "Input",
 InitializationCell->True,
 CellChangeTimes->{{3.404154162229312*^9, 3.4041541731049504`*^9}, {
   3.4041542419239073`*^9, 3.404154273108749*^9}, {3.404154385730691*^9, 
   3.404154387282923*^9}, {3.4124544010725555`*^9, 3.41245451365444*^9}, {
   3.4124546132376337`*^9, 3.412454636461027*^9}, {3.4124548445202017`*^9, 
   3.4124548744432287`*^9}, {3.412454906108762*^9, 3.412454911706811*^9}, {
   3.412455132744648*^9, 3.412455152873592*^9}, {3.4124554944247184`*^9, 
   3.412455550956006*^9}, {3.4124556231097584`*^9, 3.4124556715093536`*^9}, 
   3.4124560297044125`*^9, {3.4124563460492945`*^9, 3.412456378055317*^9}, {
   3.412456529653304*^9, 3.4124565439238243`*^9}, {3.412456676414336*^9, 
   3.4124567149397326`*^9}, {3.4124568167461233`*^9, 
   3.4124568334801855`*^9}, {3.4124575899579473`*^9, 3.4124576515965796`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["Links and Aborts", "Subtitle",
 CellDingbat->"\[FilledSquare]",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{
  StyleBox[
   RowBox[{"(*", " ", 
    RowBox[{"===", "===", "===", "===", 
     RowBox[{"\[Equal]", " ", 
      RowBox[{
      "INSTALL", " ", "AND", " ", "REINSTALL", " ", "LINK", " ", 
       "DEFINITIONS"}]}], " ", "===", "===", "\[Equal]"}], " ", "*)"}],
   FontColor->RGBColor[1, 0, 0]], 
  StyleBox["\[IndentingNewLine]",
   FontColor->RGBColor[1, 0, 0]], 
  StyleBox[
   RowBox[{"(*", " ", 
    RowBox[{
    "working", " ", "directory", " ", "set", " ", "to", " ", "location", " ", 
     "of", " ", "desired", " ", "executable"}], " ", "*)"}],
   FontColor->RGBColor[1, 0, 0]], 
  StyleBox["\[IndentingNewLine]",
   FontColor->RGBColor[1, 0, 0]], 
  StyleBox[
   RowBox[{"(*", " ", 
    RowBox[{
    "for", " ", "the", " ", "momment", " ", "put", " ", "exe", " ", "and", 
     " ", "package", " ", "together", " ", "and", " ", "set", " ", 
     "directory", " ", "to", " ", "that", " ", "spot", "\[IndentingNewLine]", 
     "\t", "to", " ", "make", " ", "distribution", " ", "simple", " ", 
     "probably", " ", "should", " ", "be", " ", "a", " ", "switch"}], "  ", 
    "*)"}],
   FontColor->RGBColor[1, 0, 0]], 
  StyleBox["\[IndentingNewLine]",
   FontColor->RGBColor[1, 0, 0]], 
  StyleBox["\[IndentingNewLine]",
   FontColor->RGBColor[1, 0, 0]], 
  RowBox[{
   RowBox[{
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{"ValueQ", "[", "Global`DAQTesting", "]"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{
       "Print", "[", "\"\<Testing...using current directory\>\"", "]"}], 
       ";"}], ",", "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{"SetDirectory", "[", 
        RowBox[{"StringJoin", "[", 
         RowBox[{
         "$InstallationDirectory", ",", 
          "\"\<\\\\AddOns\\\\ExtraPackages\\\\DAQ\>\""}], "]"}], "]"}], 
       ";"}]}], "\[IndentingNewLine]", "]"}], ";"}], 
   StyleBox["\[IndentingNewLine]",
    FontColor->RGBColor[1, 0, 0]], 
   RowBox[{
    RowBox[{"Print", "[", 
     RowBox[{"Directory", "[", "]"}], "]"}], ";"}], "\[IndentingNewLine]", 
   StyleBox["\[IndentingNewLine]",
    FontColor->RGBColor[1, 0, 0]], 
   StyleBox[
    RowBox[{
     RowBox[{"DAQlink", "=", "\"\<mathDAQ\>\""}], ";"}],
    FontColor->GrayLevel[0]], 
   StyleBox["\[IndentingNewLine]",
    FontColor->GrayLevel[0]], 
   StyleBox[
    RowBox[{"(*", " ", 
     RowBox[{
     "test", " ", "not", " ", "working", " ", "as", " ", "linkobject", " ", 
      "returned"}], " ", "*)"}],
    FontColor->GrayLevel[0]], 
   StyleBox["\n",
    FontColor->GrayLevel[0]], 
   StyleBox[
    RowBox[{
     RowBox[{
      RowBox[{"ReDoLink", "[", "]"}], ":=", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"MemberQ", "[", 
         RowBox[{
          RowBox[{"Links", "[", "]"}], ",", "DAQlink"}], "]"}], ",", 
        RowBox[{
         RowBox[{"Uninstall", "[", "DAQlink", "]"}], ";", 
         RowBox[{"Install", "[", "DAQlink", "]"}], ";"}], ",", 
        RowBox[{
         RowBox[{"Install", "[", "DAQlink", "]"}], ";"}]}], "]"}]}], ";"}],
    FontColor->GrayLevel[0]], 
   StyleBox["\[IndentingNewLine]",
    FontColor->RGBColor[1, 0, 0]], 
   StyleBox[
    RowBox[{
     RowBox[{"ReDoLink", "[", "]"}], ";"}],
    FontColor->GrayLevel[0]], 
   StyleBox["\[IndentingNewLine]",
    FontColor->GrayLevel[0]], 
   RowBox[{
    RowBox[{"If", "[", 
     RowBox[{
      RowBox[{"ValueQ", "[", "Global`DAQTesting", "]"}], ",", 
      RowBox[{"Null", ";"}], ",", 
      RowBox[{
       RowBox[{"ResetDirectory", "[", "]"}], ";"}]}], "]"}], ";"}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   StyleBox[
    RowBox[{"(*", " ", 
     RowBox[{"===", "===", 
      RowBox[{"==", "\[Equal]", " ", 
       RowBox[{
       "END", " ", "INSTALL", " ", "AND", " ", "REINSTALL", " ", "LINK", " ", 
        "DEFINITIONS"}]}], " ", "===", "===", "\[Equal]"}], " ", "*)"}],
    FontColor->RGBColor[1, 0, 0]], 
   StyleBox["\[IndentingNewLine]",
    FontColor->RGBColor[1, 0, 0]], 
   StyleBox["\[IndentingNewLine]",
    FontColor->RGBColor[1, 0, 0]], 
   RowBox[{"(*", 
    RowBox[{
     RowBox[{
     "clear", " ", "the", " ", "constants", " ", "so", " ", "if", " ", "we", 
      " ", "call", " ", 
      RowBox[{"Options", "[", "]"}], " ", "after", " ", "calling", " ", "a", 
      " ", "function", " ", 
      RowBox[{"(", 
       RowBox[{"error", " ", "or", " ", "not"}], ")"}]}], ",", " ", 
     RowBox[{
     "the", " ", "rules", " ", "still", " ", "appear", " ", "as", " ", 
      "symbols", " ", "and", " ", "not", " ", "numerically"}], ",", " ", 
     RowBox[{
     "putting", " ", "this", " ", "label", " ", "outside", " ", "the", " ", 
      "function", " ", "definitions", " ", "only", " ", "works", " ", 
      "because", " ", "this", " ", "is", " ", "a", " ", "saved", " ", 
      "initiallization", " ", "cell"}]}], "*)"}], "\[IndentingNewLine]", 
   StyleBox["\[IndentingNewLine]",
    FontColor->GrayLevel[0]], 
   RowBox[{
    RowBox[{"Label", "[", "linkabort", "]"}], ";"}], "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"linkabort", ":=", 
     RowBox[{"(", 
      RowBox[{"clearconstants", ";", "\[IndentingNewLine]", 
       RowBox[{"Abort", "[", "]"}], ";"}], ")"}]}], ";"}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"Label", "[", "clearandabort", "]"}], ";"}], 
   "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"clearandabort", ":=", "\[IndentingNewLine]", 
     RowBox[{"(", 
      RowBox[{
       RowBox[{"If", "[", 
        RowBox[{
         RowBox[{"messagelevel", "===", "0"}], ",", "Null", ",", 
         RowBox[{"Print", "[", "error", "]"}]}], "]"}], ";", 
       "\[IndentingNewLine]", "clearconstants", ";", "\[IndentingNewLine]", 
       RowBox[{"Abort", "[", "]"}], ";"}], ")"}]}], ";"}]}]}]], "Input",
 InitializationCell->True,
 CellChangeTimes->{{3.408207814667323*^9, 3.408207897967102*^9}, 
   3.408208450411478*^9, {3.408208596962208*^9, 3.408208635998339*^9}, {
   3.409447140937507*^9, 3.409447241652328*^9}, {3.4094473064955683`*^9, 
   3.4094473842673984`*^9}, 3.409447599587013*^9, {3.409448008284691*^9, 
   3.409448050184941*^9}, {3.409449833078616*^9, 3.409449843062973*^9}, {
   3.4094502000062323`*^9, 3.4094502088990192`*^9}, {3.4094505124154544`*^9, 
   3.4094505501697426`*^9}, {3.409492233095323*^9, 3.409492259873829*^9}, 
   3.4094923711438274`*^9, {3.409496041070923*^9, 3.4094960659466925`*^9}, {
   3.409497251932056*^9, 3.4094972988094625`*^9}, {3.409497508330739*^9, 
   3.4094976502448015`*^9}, {3.4094979065633698`*^9, 3.409497936987117*^9}, 
   3.4094982348554306`*^9, 3.4094982977158194`*^9, 3.409498510391632*^9, {
   3.4094985499384975`*^9, 3.4094985582003775`*^9}, {3.409499126607707*^9, 
   3.40949915576964*^9}, {3.4221074440978303`*^9, 3.422107447022035*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["Main Function Definitions", "Subtitle",
 CellDingbat->"\[FilledSquare]",
 InitializationCell->True],

Cell[CellGroupData[{

Cell["\tGetVoltages", "Subsubtitle",
 CellDingbat->"\[GraySquare]",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{
  StyleBox[
   RowBox[{"(*", 
    RowBox[{"===", "===", "===", "===", " ", 
     RowBox[{"GetVoltages", " ", "Definition", " ", "Section"}], " ", "===", "===",
      "===", "=="}], "*)"}],
   FontColor->RGBColor[1, 0, 0]], "\[IndentingNewLine]", 
  StyleBox["\[IndentingNewLine]",
   FontColor->RGBColor[1, 0, 0]], 
  RowBox[{
   RowBox[{
    RowBox[{"GetVoltages", "::", "badarg"}], "=", 
    "\"\<GetVoltages must be called with 3 arguments.\>\""}], 
   StyleBox["\[IndentingNewLine]",
    FontColor->GrayLevel[0]], 
   StyleBox["\[IndentingNewLine]",
    FontColor->GrayLevel[0]], 
   RowBox[{
    StyleBox[
     RowBox[{"GetVoltages", "[", 
      RowBox[{
      "channel_", ",", "frequency_", ",", "numberofsamples_", ",", 
       "opts___Rule"}], "]"}],
     FontColor->GrayLevel[0]], 
    StyleBox[":=",
     FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
    RowBox[{"(", 
     RowBox[{"clearconstants", ";", "\[IndentingNewLine]", 
      RowBox[{"chan", "=", "channel"}], ";", "\[IndentingNewLine]", 
      RowBox[{"freq", "=", "frequency"}], ";", "\[IndentingNewLine]", 
      RowBox[{"samples", "=", "numberofsamples"}], ";", "\[IndentingNewLine]",
       "\[IndentingNewLine]", 
      RowBox[{"optionlist", "=", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
         "Global`Device", ",", "Global`TerminalMode", ",", "Global`MinValue", 
          ",", "Global`MaxValue", ",", "Global`Units", ",", 
          "Global`ClockSource", ",", "Global`ActiveEdge", ",", 
          "Global`SampleMode", ",", "Global`TimeOut", ",", 
          "Global`MessageLevel", ",", "Global`IncludeTime", ",", 
          "Global`SetupOnly", ",", "Global`TransferMechanism"}], "}"}], "/.", 
        
        RowBox[{"Flatten", "[", 
         RowBox[{"{", 
          RowBox[{"opts", ",", 
           RowBox[{"Options", "[", "GetVoltages", "]"}]}], "}"}], "]"}]}]}], 
      ";", "\[IndentingNewLine]", 
      RowBox[{"golocal", "=", 
       RowBox[{"{", 
        RowBox[{
        "device", ",", "terminalmode", ",", "minvalue", ",", "maxvalue", ",", 
         "units", ",", "clocksource", ",", "activeedge", ",", "samplemode", 
         ",", "timeout", ",", "messagelevel", ",", "includetime", ",", 
         "setuponly", ",", "transfermechanism"}], "}"}]}], ";", 
      StyleBox["\[IndentingNewLine]",
       FontColor->GrayLevel[0]], 
      RowBox[{"Apply", "[", 
       RowBox[{"Set", ",", 
        RowBox[{"Transpose", "[", 
         RowBox[{"{", 
          RowBox[{"golocal", ",", "optionlist"}], "}"}], "]"}], ",", "1"}], 
       "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
      "argumenttests", ";", "\[IndentingNewLine]", "optiontests", ";", 
      "\[IndentingNewLine]", "setconstants", ";", "\[IndentingNewLine]", 
      "getnumberofchannels", ";", "\[IndentingNewLine]", 
      "getinputdevicestring", ";", "\[IndentingNewLine]", 
      "\[IndentingNewLine]", 
      RowBox[{"listforcall", "=", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{"\"\<channels\>\"", ",", "devicestring"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<numchannels\>\"", ",", "numberofchannels"}], "}"}], 
         ",", 
         RowBox[{"{", 
          RowBox[{"\"\<frequency\>\"", ",", 
           RowBox[{"N", "[", "freq", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<samples\>\"", ",", "samples"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<terminalmode\>\"", ",", "terminalmode"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<min\>\"", ",", 
           RowBox[{"N", "[", "minvalue", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<max\>\"", ",", 
           RowBox[{"N", "[", "maxvalue", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<units\>\"", ",", "units"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<clock\>\"", ",", 
           RowBox[{"ToString", "[", "clocksource", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<activeedge\>\"", ",", "activeedge"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<samplemode\>\"", ",", "0"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<timeout\>\"", ",", 
           RowBox[{"N", "[", "timeout", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<messagelevel\>\"", ",", "messagelevel"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<setuponly\>\"", ",", "setupflag"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<transfermech\>\"", ",", "transfermechanism"}], "}"}]}],
         "}"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"listfromcall", "=", 
       RowBox[{"CheckAbort", "[", 
        RowBox[{
         RowBox[{"Global`GetVoltagesCpp", "[", "listforcall", "]"}], ",", 
         RowBox[{
          RowBox[{"LinkInterrupt", "[", "DAQlink", "]"}], ";", 
          RowBox[{"Goto", "[", "linkabort", "]"}]}]}], "]"}]}], ";", 
      "\[IndentingNewLine]", "\[IndentingNewLine]", 
      RowBox[{"(*", " ", 
       RowBox[{"Fix", " ", "me", " ", "control", " ", "flow", " ", 
        RowBox[{"problem", " ", "--"}], " ", "checksetuponly", " ", "shound", 
        " ", "skip", " ", "the", " ", "following", " ", "functions"}], " ", 
       "*)"}], "\[IndentingNewLine]", "checksetuponly", ";", 
      "\[IndentingNewLine]", "getpostimelist", ";", "\[IndentingNewLine]", 
      "getcompletelist", ";", "\[IndentingNewLine]", "messages", ";", 
      "\[IndentingNewLine]", "clearconstants", ";", "\[IndentingNewLine]", 
      "getnewlistfromcall", ";", "\[IndentingNewLine]", 
      RowBox[{"Return", "[", "newlistfromcall", "]"}]}], " ", ")"}]}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{
     RowBox[{"GetVoltages", "[", 
      RowBox[{"arg__", "/;", 
       RowBox[{
        RowBox[{
         RowBox[{"Length", "[", 
          RowBox[{"{", "arg", "}"}], "]"}], "<", "3"}], "||", 
        RowBox[{
         RowBox[{"Length", "[", 
          RowBox[{"{", "arg", "}"}], "]"}], ">", "3"}]}]}], "]"}], ":=", 
     RowBox[{"Message", "[", 
      RowBox[{
       RowBox[{"GetVoltages", "::", "badarg"}], ",", 
       RowBox[{"{", "arg", "}"}]}], "]"}]}], ";"}], 
   StyleBox["\[IndentingNewLine]",
    FontColor->RGBColor[1, 0, 0]], 
   StyleBox[
    RowBox[{"(*", 
     RowBox[{"===", "===", "===", "===", "===", " ", 
      RowBox[{"END", " ", "GETVOLTAGES", " ", "DEFINITION"}], " ", "===", "===",
       "===", "===", "==="}], "*)"}],
    FontColor->RGBColor[1, 0, 0]]}]}]], "Input",
 InitializationCell->True,
 CellChangeTimes->{{3.4124569916175756`*^9, 3.4124570648829265`*^9}, {
  3.449276899706869*^9, 3.449276919331869*^9}, {3.449277096066244*^9, 
  3.449277106347494*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["\tGetVoltagesTrig", "Subsubtitle",
 CellDingbat->"\[GraySquare]",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{
  StyleBox[
   RowBox[{"(*", 
    RowBox[{"===", 
     RowBox[{"=", " ", 
      RowBox[{
       RowBox[{"GetVoltagesTrig", " ", "Definition", " ", "Section"}], " ", "===",
        "\[Equal]"}]}]}], "*)"}],
   FontColor->RGBColor[1, 0, 0]], 
  StyleBox["\[IndentingNewLine]",
   FontColor->RGBColor[1, 0, 0]], 
  StyleBox["\[IndentingNewLine]",
   FontColor->RGBColor[1, 0, 0]], 
  RowBox[{
   RowBox[{
    RowBox[{"GetVoltagesTrig", "::", "badarg"}], "=", 
    "\"\<GetVoltagesTrig must be called with 5 arguments.\>\""}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"GetVoltagesTrig", "[", 
     RowBox[{
     "channel_", ",", "frequency_", ",", "numberofsamples_", ",", 
      "triggerchannel_", ",", "triggerlevel_", ",", "opts___Rule"}], "]"}], ":=", 
    RowBox[{"(", 
     RowBox[{"clearconstants", ";", "\[IndentingNewLine]", 
      RowBox[{"chan", "=", "channel"}], ";", "\[IndentingNewLine]", 
      RowBox[{"freq", "=", "frequency"}], ";", "\[IndentingNewLine]", 
      RowBox[{"samples", "=", "numberofsamples"}], ";", "\[IndentingNewLine]", 
      RowBox[{"trigchannel", "=", "triggerchannel"}], ";", 
      "\[IndentingNewLine]", 
      RowBox[{"triglevel", "=", "triggerlevel"}], ";", "\[IndentingNewLine]", 
      "\[IndentingNewLine]", 
      RowBox[{"optionlist", "=", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
         "Global`Device", ",", "Global`TerminalMode", ",", "Global`MinValue", 
          ",", "Global`MaxValue", ",", "Global`Units", ",", 
          "Global`ClockSource", ",", "Global`ActiveEdge", ",", 
          "Global`SampleMode", ",", "Global`TimeOut", ",", 
          "Global`TriggerSlope", ",", "Global`PreTriggerSamples", ",", 
          "Global`MessageLevel", ",", "Global`IncludeTime", ",", 
          "Global`SetupOnly", ",", "Global`TransferMechanism"}], "}"}], "/.", 
        
        RowBox[{"Flatten", "[", 
         RowBox[{"{", 
          RowBox[{"opts", ",", 
           RowBox[{"Options", "[", "GetVoltagesTrig", "]"}]}], "}"}], "]"}]}]}
       ], ";", "\[IndentingNewLine]", 
      RowBox[{"golocal", "=", 
       RowBox[{"{", 
        RowBox[{
        "device", ",", "terminalmode", ",", "minvalue", ",", "maxvalue", ",", 
         "units", ",", "clocksource", ",", "activeedge", ",", "samplemode", 
         ",", "timeout", ",", "triggerslope", ",", "pretriggersamples", ",", 
         "messagelevel", ",", "includetime", ",", "setuponly", ",", 
         "transfermechanism"}], "}"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"Apply", "[", 
       RowBox[{"Set", ",", 
        RowBox[{"Transpose", "[", 
         RowBox[{"{", 
          RowBox[{"golocal", ",", "optionlist"}], "}"}], "]"}], ",", "1"}], 
       "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
      "argumenttests", ";", "\[IndentingNewLine]", "optiontests", ";", 
      "\[IndentingNewLine]", "setconstants", ";", "\[IndentingNewLine]", 
      "getnumberofchannels", ";", "\[IndentingNewLine]", 
      "getinputdevicestring", ";", "\[IndentingNewLine]", 
      RowBox[{"sourcestring", ":=", 
       RowBox[{"\"\<PFI\>\"", "<>", 
        RowBox[{"ToString", "[", "trigchannel", "]"}]}]}], ";", 
      "\[IndentingNewLine]", "\[IndentingNewLine]", 
      RowBox[{"listforcall", "=", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{"\"\<channels\>\"", ",", "devicestring"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<numchannels\>\"", ",", "numberofchannels"}], "}"}], 
         ",", 
         RowBox[{"{", 
          RowBox[{"\"\<frequency\>\"", ",", 
           RowBox[{"N", "[", "freq", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<pretrigsamples\>\"", ",", "pretriggersamples"}], "}"}],
          ",", 
         RowBox[{"{", 
          RowBox[{"\"\<posttrigsamples\>\"", ",", "samples"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<samples\>\"", ",", "pretriggersamples"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<terminalmode\>\"", ",", "terminalmode"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<min\>\"", ",", 
           RowBox[{"N", "[", "minvalue", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<max\>\"", ",", 
           RowBox[{"N", "[", "maxvalue", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<units\>\"", ",", "units"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<clock\>\"", ",", 
           RowBox[{"ToString", "[", "clocksource", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<activeedge\>\"", ",", "activeedge"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<samplemode\>\"", ",", "1"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<timeout\>\"", ",", 
           RowBox[{"N", "[", "timeout", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<messagelevel\>\"", ",", "messagelevel"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<triggersource\>\"", ",", "sourcestring"}], "}"}], ",", 
         
         RowBox[{"{", 
          RowBox[{"\"\<triggerslope\>\"", ",", "triggerslope"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<triggerlevel\>\"", ",", 
           RowBox[{"N", "[", "triglevel", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<transfermech\>\"", ",", "transfermechanism"}], "}"}], 
         ",", 
         RowBox[{"{", 
          RowBox[{"\"\<setuponly\>\"", ",", "setupflag"}], "}"}]}], "}"}]}], 
      ";", "\[IndentingNewLine]", 
      RowBox[{"listfromcall", "=", 
       RowBox[{"CheckAbort", "[", 
        RowBox[{
         RowBox[{"Global`GetVoltagesSoftwareTrig", "[", "listforcall", "]"}], 
         ",", 
         RowBox[{
          RowBox[{"LinkInterrupt", "[", "DAQlink", "]"}], ";", 
          RowBox[{"Goto", "[", "linkabort", "]"}], ";"}]}], "]"}]}], ";", 
      "\[IndentingNewLine]", "\[IndentingNewLine]", 
      RowBox[{"(*", " ", 
       RowBox[{"Diagnostic", " ", 
        RowBox[{"print", " ", "--"}], " ", "perhaps", " ", "make", " ", 
        "this", " ", "a", " ", "function", " ", "of", " ", "message", " ", 
        "level"}], " ", "*)"}], "\[IndentingNewLine]", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"messagelevel", " ", "\[GreaterEqual]", " ", "1"}], ",", 
        "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"Print", "[", 
          RowBox[{
          "\"\<GetVoltagesTrig (Software trigger) print listfrom call: \>\"", 
           " ", ",", "\"\<\\n\>\"", ",", " ", "listfromcall"}], "]"}], ";"}], 
        ",", "\[IndentingNewLine]", "Null"}], "]"}], ";", 
      "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
      "\[IndentingNewLine]", "checksetuponly", ";", "\[IndentingNewLine]", 
      "getpostimelist", ";", "\[IndentingNewLine]", "getnegtimelist", ";", 
      "\[IndentingNewLine]", "gettrigcompletelist", ";", 
      "\[IndentingNewLine]", "\[IndentingNewLine]", "messages", ";", 
      "\[IndentingNewLine]", "clearconstants", ";", "\[IndentingNewLine]", 
      "\[IndentingNewLine]", "getnewlistfromcall", ";", "\[IndentingNewLine]", 
      RowBox[{"Return", "[", "newlistfromcall", "]"}]}], ")"}]}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{
     RowBox[{"GetVoltagesTrig", "[", 
      RowBox[{"arg__", "/;", 
       RowBox[{
        RowBox[{
         RowBox[{"Length", "[", 
          RowBox[{"{", "arg", "}"}], "]"}], "<", "5"}], "||", 
        RowBox[{
         RowBox[{"Length", "[", 
          RowBox[{"{", "arg", "}"}], "]"}], ">", "5"}]}]}], "]"}], ":=", 
     RowBox[{"Message", "[", 
      RowBox[{
       RowBox[{"GetVoltagesTrig", "::", "badarg"}], ",", 
       RowBox[{"{", "arg", "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", 
   StyleBox[
    RowBox[{"(*", 
     RowBox[{"===", 
      RowBox[{"=", " ", 
       RowBox[{
        RowBox[{
        "END", " ", "GetVoltagesTrig", " ", "Definition", " ", "Section"}], 
        " ", "===", "\[Equal]"}]}]}], "*)"}],
    FontColor->RGBColor[1, 0, 0]], "\[IndentingNewLine]"}]}]], "Input",
 InitializationCell->True,
 CellChangeTimes->{{3.512696788140625*^9, 3.51269679928125*^9}, {
  3.5127387321875*^9, 3.512738738484375*^9}, {3.51274102075*^9, 
  3.51274107075*^9}, {3.513102795875*^9, 3.513102801734375*^9}, {
  3.51310303475*^9, 3.513103047640625*^9}, {3.513103141328125*^9, 
  3.51310314453125*^9}, {3.51318147859375*^9, 3.51318149071875*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["\tGetVoltagesDigTrig", "Subsubtitle",
 CellDingbat->"\[GraySquare]",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{
  StyleBox[
   RowBox[{"(*", 
    RowBox[{
     RowBox[{"===", "==="}], "=", " ", 
     RowBox[{
      RowBox[{
       RowBox[{"GetVoltagesDigTrig", " ", "Definition", " ", "Section"}], " ",
        "==="}], "="}]}], "*)"}],
   FontColor->RGBColor[1, 0, 0]], 
  StyleBox["\[IndentingNewLine]",
   FontColor->RGBColor[1, 0, 0]], 
  StyleBox["\[IndentingNewLine]",
   FontColor->RGBColor[1, 0, 0]], 
  RowBox[{
   RowBox[{
    RowBox[{"GetVoltagesDigTrig", "::", "badarg"}], "=", 
    "\"\<GetVoltagesDigTrig must be called with 4 arguments.\>\""}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"GetVoltagesDigTrig", "[", 
     RowBox[{
     "channel_", ",", "frequency_", ",", "numberofsamples_", ",", 
      "triggerchannel_", ",", "opts___Rule"}], "]"}], ":=", 
    StyleBox["\[IndentingNewLine]",
     FontColor->RGBColor[1, 0, 0]], 
    RowBox[{"(", 
     RowBox[{"clearconstants", ";", "\[IndentingNewLine]", 
      RowBox[{"chan", "=", "channel"}], ";", "\[IndentingNewLine]", 
      RowBox[{"freq", "=", "frequency"}], ";", "\[IndentingNewLine]", 
      RowBox[{"samples", "=", "numberofsamples"}], ";", "\[IndentingNewLine]", 
      RowBox[{"trigchannel", "=", "triggerchannel"}], ";", 
      "\[IndentingNewLine]", "\[IndentingNewLine]", 
      RowBox[{"optionlist", "=", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
         "Global`Device", ",", "Global`TerminalMode", ",", "Global`MinValue", 
          ",", "Global`MaxValue", ",", "Global`Units", ",", 
          "Global`ClockSource", ",", "Global`ActiveEdge", ",", 
          "Global`SampleMode", ",", "Global`TimeOut", ",", 
          "Global`MessageLevel", ",", "Global`IncludeTime", ",", 
          "Global`TriggerSlope", ",", "Global`PreTriggerSamples", ",", 
          "Global`SetupOnly", ",", "Global`TransferMechanism"}], "}"}], "/.", 
        
        RowBox[{"Flatten", "[", 
         RowBox[{"{", 
          RowBox[{"opts", ",", 
           RowBox[{"Options", "[", "GetVoltagesDigTrig", "]"}]}], "}"}], "]"}]
         }]}], ";", "\[IndentingNewLine]", 
      RowBox[{"golocal", "=", 
       RowBox[{"{", 
        RowBox[{
        "device", ",", "terminalmode", ",", "minvalue", ",", "maxvalue", ",", 
         "units", ",", "clocksource", ",", "activeedge", ",", "samplemode", 
         ",", "timeout", ",", "messagelevel", ",", "includetime", ",", 
         "triggerslope", ",", "pretriggersamples", ",", "setuponly", ",", 
         "transfermechanism"}], "}"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"Apply", "[", 
       RowBox[{"Set", ",", 
        RowBox[{"Transpose", "[", 
         RowBox[{"{", 
          RowBox[{"golocal", ",", "optionlist"}], "}"}], "]"}], ",", "1"}], 
       "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
      "argumenttests", ";", "\[IndentingNewLine]", "optiontests", ";", 
      "\[IndentingNewLine]", "setconstants", ";", "\[IndentingNewLine]", 
      "getnumberofchannels", ";", "\[IndentingNewLine]", 
      "getinputdevicestring", ";", "\[IndentingNewLine]", 
      RowBox[{"sourcestring", ":=", 
       RowBox[{"\"\<PFI\>\"", "<>", 
        RowBox[{"ToString", "[", "trigchannel", "]"}]}]}], ";", 
      "\[IndentingNewLine]", "\[IndentingNewLine]", 
      RowBox[{"listforcall", "=", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{"\"\<channels\>\"", ",", "devicestring"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<numchannels\>\"", ",", "numberofchannels"}], "}"}], 
         ",", 
         RowBox[{"{", 
          RowBox[{"\"\<frequency\>\"", ",", 
           RowBox[{"N", "[", "freq", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<terminalmode\>\"", ",", "terminalmode"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<min\>\"", ",", 
           RowBox[{"N", "[", "minvalue", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<max\>\"", ",", 
           RowBox[{"N", "[", "maxvalue", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<units\>\"", ",", "units"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<clock\>\"", ",", 
           RowBox[{"ToString", "[", "clocksource", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<activeedge\>\"", ",", "activeedge"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<samplemode\>\"", ",", "0"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<timeout\>\"", ",", 
           RowBox[{"N", "[", "timeout", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<messagelevel\>\"", ",", "messagelevel"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<triggersource\>\"", ",", "sourcestring"}], "}"}], ",", 
         
         RowBox[{"{", 
          RowBox[{"\"\<triggerslope\>\"", ",", "triggerslope"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<pretrigsamples\>\"", ",", "pretriggersamples"}], "}"}],
          ",", 
         RowBox[{"{", 
          RowBox[{"\"\<samples\>\"", ",", "samples"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<posttrigsamples\>\"", ",", "samples"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<setuponly\>\"", ",", "setupflag"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<transfermech\>\"", ",", "transfermechanism"}], "}"}]}],
         "}"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"listfromcall", "=", 
       RowBox[{"CheckAbort", "[", 
        RowBox[{
         RowBox[{"Global`GetVoltagesDigitalTrig", "[", "listforcall", "]"}], 
         ",", 
         RowBox[{
          RowBox[{"LinkInterrupt", "[", "DAQlink", "]"}], ";", 
          RowBox[{"Goto", "[", "linkabort", "]"}], ";"}]}], "]"}]}], ";", 
      "\[IndentingNewLine]", "\[IndentingNewLine]", 
      RowBox[{"(*", " ", 
       RowBox[{"Diagnostic", " ", 
        RowBox[{"print", " ", "--"}], " ", "perhaps", " ", "make", " ", 
        "this", " ", "a", " ", "function", " ", "of", " ", "message", " ", 
        "level"}], " ", "*)"}], "\[IndentingNewLine]", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"messagelevel", " ", "\[GreaterEqual]", " ", "1"}], ",", 
        "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"Print", "[", 
          RowBox[{
          "\"\<GetVoltagesDigTrig print list from : \>\"", ",", " ", 
           "\"\<\\n\>\"", ",", " ", "listfromcall"}], "]"}], ";"}], ",", 
        "\[IndentingNewLine]", "Null"}], "]"}], ";", "\[IndentingNewLine]", 
      "\[IndentingNewLine]", "checksetuponly", ";", "\[IndentingNewLine]", 
      "getpostimelist", ";", "\[IndentingNewLine]", "getnegtimelist", ";", 
      "\[IndentingNewLine]", "gettrigcompletelist", ";", 
      StyleBox["\[IndentingNewLine]",
       FontColor->GrayLevel[0]], 
      StyleBox["messages",
       FontColor->GrayLevel[0]], 
      StyleBox[";",
       FontColor->GrayLevel[0]], 
      StyleBox["\[IndentingNewLine]",
       FontColor->GrayLevel[0]], 
      StyleBox["clearconstants",
       FontColor->GrayLevel[0]], 
      StyleBox[";",
       FontColor->GrayLevel[0]], 
      StyleBox["\[IndentingNewLine]",
       FontColor->GrayLevel[0]], 
      StyleBox["getnewlistfromcall",
       FontColor->GrayLevel[0]], 
      StyleBox[";",
       FontColor->GrayLevel[0]], 
      StyleBox["\[IndentingNewLine]",
       FontColor->GrayLevel[0]], 
      StyleBox[
       RowBox[{"Return", "[", "newlistfromcall", "]"}],
       FontColor->GrayLevel[0]]}], 
     StyleBox[")",
      FontColor->GrayLevel[0]]}]}], 
   StyleBox["\[IndentingNewLine]",
    FontColor->GrayLevel[0]], 
   StyleBox["\[IndentingNewLine]",
    FontColor->GrayLevel[0]], 
   RowBox[{
    RowBox[{
     StyleBox[
      RowBox[{"GetVoltagesDigTrig", "[", 
       RowBox[{"arg__", "/;", 
        RowBox[{
         RowBox[{
          RowBox[{"Length", "[", 
           RowBox[{"{", "arg", "}"}], "]"}], "<", "4"}], "||", 
         RowBox[{
          RowBox[{"Length", "[", 
           RowBox[{"{", "arg", "}"}], "]"}], ">", "4"}]}]}], "]"}],
      FontColor->GrayLevel[0]], 
     StyleBox[":=",
      FontColor->GrayLevel[0]], 
     RowBox[{
      StyleBox["Message",
       FontColor->GrayLevel[0]], 
      StyleBox["[",
       FontColor->GrayLevel[0]], 
      RowBox[{
       RowBox[{"GetVoltagesDigTrig", "::", "badarg"}], ",", 
       RowBox[{"{", "arg", "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", 
   StyleBox["\[IndentingNewLine]",
    FontColor->RGBColor[1, 0, 0]], 
   StyleBox[
    RowBox[{"(*", 
     RowBox[{"===", 
      RowBox[{"=", " ", 
       RowBox[{
        RowBox[{
        "END", " ", "GetVoltagesDigTrig", " ", "Definition", " ", "Section"}],
         " ", "===", "\[Equal]"}]}]}], "*)"}],
    FontColor->RGBColor[1, 0, 0]], "\[IndentingNewLine]"}]}]], "Input",
 InitializationCell->True,
 CellChangeTimes->{{3.4041530505507965`*^9, 3.4041530532046127`*^9}, 
   3.4041531552513485`*^9, {3.4041549459963136`*^9, 3.404154946927653*^9}, {
   3.449273374128744*^9, 3.449273374191244*^9}, {3.449273670738119*^9, 
   3.449273671191244*^9}, {3.449276125144369*^9, 3.449276127269369*^9}, {
   3.449347046906787*^9, 3.449347114593854*^9}, {3.4493488523658543`*^9, 
   3.4493488673971043`*^9}, {3.512738749609375*^9, 3.512738756453125*^9}, {
   3.51273889921875*^9, 3.51273905375*^9}, {3.512739407578125*^9, 
   3.512739422671875*^9}, {3.512739834546875*^9, 3.51273985734375*^9}, {
   3.512739907328125*^9, 3.512739907484375*^9}, {3.512740355453125*^9, 
   3.51274035596875*^9}, {3.512740463453125*^9, 3.51274046359375*^9}, {
   3.5127407066875*^9, 3.5127407715625*^9}, {3.512740802921875*^9, 
   3.512740819203125*^9}, {3.513094677*^9, 3.51309469325*^9}, {
   3.513102814109375*^9, 3.5131028253125*^9}, {3.51310296965625*^9, 
   3.513102989546875*^9}, 3.51310315775*^9, {3.513181381578125*^9, 
   3.513181399625*^9}, {3.513181430640625*^9, 3.513181448375*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["\tOutputVoltage", "Subsubtitle",
 CellDingbat->"\[GraySquare]",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{
  StyleBox[
   RowBox[{"(*", 
    RowBox[{"===", 
     RowBox[{"=", " ", 
      RowBox[{
       RowBox[{"OutputVoltage", " ", "Definition", " ", "Section"}], " ", "===",
        "\[Equal]"}]}]}], "*)"}],
   FontColor->RGBColor[1, 0, 0]], 
  StyleBox["\[IndentingNewLine]",
   FontColor->RGBColor[1, 0, 0]], 
  StyleBox[
   RowBox[{"(*", 
    RowBox[{"===", 
     RowBox[{"=", " ", 
      RowBox[{"Note", ":", " ", 
       RowBox[{
        RowBox[{"OutputVoltage", " ", "calls", " ", "OutputWaveformCpp"}], 
        " ", "===", "\[Equal]"}]}]}]}], "*)"}],
   FontColor->RGBColor[1, 0, 0]], "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{
    RowBox[{"OutputVoltage", "::", "badarg"}], "=", 
    "\"\<OutputVoltage must be called with 2 arguments.\>\""}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"OutputVoltage", "[", 
     RowBox[{"channel_", ",", "voltage_", ",", "opts___Rule"}], "]"}], ":=", 
    "\[IndentingNewLine]", 
    RowBox[{"(", 
     RowBox[{"clearconstants", ";", "\[IndentingNewLine]", 
      RowBox[{"wavechan", "=", "channel"}], ";", "\[IndentingNewLine]", 
      RowBox[{"wave", "=", 
       RowBox[{"{", "voltage", "}"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"outputflag", "=", "1"}], ";", "\[IndentingNewLine]", 
      RowBox[{"optionlist", ":=", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
         "Global`Device", ",", "Global`MinValue", ",", "Global`MaxValue", ",",
           "Global`Units", ",", "Global`TimeOut", ",", "Global`MessageLevel", 
          ",", "Global`SetupOnly", ",", "Global`TransferMechanism"}], "}"}], "/.", 
        RowBox[{"Flatten", "[", 
         RowBox[{"{", 
          RowBox[{"opts", ",", 
           RowBox[{"Options", "[", "OutputVoltage", "]"}]}], "}"}], "]"}]}]}],
       ";", "\[IndentingNewLine]", 
      RowBox[{"golocal", "=", 
       RowBox[{"{", 
        RowBox[{
        "device", ",", "minvalue", ",", "maxvalue", ",", "units", ",", 
         "timeout", ",", "messagelevel", ",", "setuponly", ",", 
         "transfermechanism"}], "}"}]}], ";", 
      StyleBox["\[IndentingNewLine]",
       FontColor->GrayLevel[0]], 
      RowBox[{"Apply", "[", 
       RowBox[{"Set", ",", 
        RowBox[{"Transpose", "[", 
         RowBox[{"{", 
          RowBox[{"golocal", ",", "optionlist"}], "}"}], "]"}], ",", "1"}], 
       "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
      "argumenttests", ";", "\[IndentingNewLine]", "optiontests", ";", 
      "\[IndentingNewLine]", "setconstants", ";", "\[IndentingNewLine]", 
      "getnumberofchannels", ";", "\[IndentingNewLine]", 
      "getoutputdevicestring", ";", "\[IndentingNewLine]", 
      "\[IndentingNewLine]", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"numberofchannels", "===", "2"}], ",", 
        RowBox[{"newwave", "=", 
         RowBox[{"Join", "[", 
          RowBox[{"wave", ",", "wave"}], "]"}]}], ",", 
        RowBox[{"newwave", "=", "wave"}]}], "]"}], ";", "\[IndentingNewLine]", 
      RowBox[{"listforcall", "=", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{"\"\<channels\>\"", ",", "devicestring"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<numchannels\>\"", ",", "numberofchannels"}], "}"}], 
         ",", 
         RowBox[{"{", 
          RowBox[{"\"\<waveform\>\"", ",", 
           RowBox[{"newwave", "//", "N"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<frequency\>\"", ",", 
           RowBox[{"N", "[", "1", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<samples\>\"", ",", "1"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<numperiods\>\"", ",", 
           RowBox[{"N", "[", "1", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<min\>\"", ",", 
           RowBox[{"N", "[", "minvalue", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<max\>\"", ",", 
           RowBox[{"N", "[", "maxvalue", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<units\>\"", ",", "units"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<transfermech\>\"", ",", "transfermechanism"}], "}"}], 
         ",", 
         RowBox[{"{", 
          RowBox[{"\"\<clock\>\"", ",", "\"\<OnboardClock\>\""}], "}"}], ",", 
         
         RowBox[{"{", 
          RowBox[{"\"\<activeedge\>\"", ",", "0"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<samplemode\>\"", ",", "0"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<timeout\>\"", ",", 
           RowBox[{"N", "[", "timeout", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<messagelevel\>\"", ",", "messagelevel"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<setuponly\>\"", ",", "setupflag"}], "}"}]}], "}"}]}], 
      ";", "\[IndentingNewLine]", 
      RowBox[{"taskhandle", "=", 
       RowBox[{"CheckAbort", "[", 
        RowBox[{
         RowBox[{"Global`OutputWaveformCpp", "[", "listforcall", "]"}], ",", 
         RowBox[{
          RowBox[{"LinkInterrupt", "[", "DAQlink", "]"}], ";", 
          RowBox[{"Goto", "[", "linkabort", "]"}], ";"}]}], "]"}]}], ";", 
      "\[IndentingNewLine]", "\[IndentingNewLine]", "messages", ";", 
      "\[IndentingNewLine]", "clearconstants", ";", "\[IndentingNewLine]", 
      RowBox[{"Return", "[", "taskhandle", "]"}]}], ")"}]}], 
   StyleBox["\[IndentingNewLine]",
    FontColor->RGBColor[1, 0, 0]], 
   StyleBox["\[IndentingNewLine]",
    FontColor->RGBColor[1, 0, 0]], 
   RowBox[{
    RowBox[{
     RowBox[{"OutputVoltage", "[", 
      RowBox[{"arg__", "/;", 
       RowBox[{
        RowBox[{
         RowBox[{"Length", "[", 
          RowBox[{"{", "arg", "}"}], "]"}], "<", "2"}], "||", 
        RowBox[{
         RowBox[{"Length", "[", 
          RowBox[{"{", "arg", "}"}], "]"}], ">", "2"}]}]}], "]"}], ":=", 
     RowBox[{"Message", "[", 
      RowBox[{
       RowBox[{"OutputVoltage", "::", "badarg"}], ",", 
       RowBox[{"{", "arg", "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", 
   StyleBox["\[IndentingNewLine]",
    FontColor->RGBColor[1, 0, 0]], 
   StyleBox[
    RowBox[{"(*", 
     RowBox[{"===", "===", "===", 
      RowBox[{"==", " ", 
       RowBox[{
       "End", " ", "OutputVoltage", " ", "Definition", " ", "Section"}]}], 
      " ", "===", "===", "===", "\[Equal]"}], "*)"}],
    FontColor->RGBColor[1, 0, 0]], "\[IndentingNewLine]"}]}]], "Input",
 InitializationCell->True,
 CellChangeTimes->{{3.4124582480342145`*^9, 3.4124583000289793`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["\tOutputWaveform", "Subsubtitle",
 CellDingbat->"\[GraySquare]",
 InitializationCell->True],

Cell[BoxData[
 RowBox[{
  StyleBox[
   RowBox[{"(*", 
    RowBox[{"===", "===", "===", 
     RowBox[{"==", " ", 
      RowBox[{"OutputWaveform", " ", "Definition", " ", "Section"}]}], " ", "===",
      "===", "===", "\[Equal]"}], "*)"}],
   FontColor->RGBColor[1, 0, 0]], "\[IndentingNewLine]", 
  StyleBox["\[IndentingNewLine]",
   FontColor->RGBColor[1, 0, 0]], 
  RowBox[{
   RowBox[{
    RowBox[{"OutputWaveform", "::", "badarg"}], "=", 
    "\"\<OutputWaveform must be called with 4 arguments.\>\""}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"OutputWaveform", "[", 
     RowBox[{
     "channel_", ",", "waveform_", ",", "frequency_", ",", "numberofperiods_",
       ",", "opts___Rule"}], "]"}], ":=", 
    StyleBox["\[IndentingNewLine]",
     FontColor->RGBColor[1, 0, 0]], 
    RowBox[{"(", 
     RowBox[{"clearconstants", ";", "\[IndentingNewLine]", 
      RowBox[{"wavechan", "=", "channel"}], ";", "\[IndentingNewLine]", 
      RowBox[{"wave", "=", "waveform"}], ";", "\[IndentingNewLine]", 
      RowBox[{"freq", "=", "frequency"}], ";", "\[IndentingNewLine]", 
      RowBox[{"periods", "=", "numberofperiods"}], ";", "\[IndentingNewLine]",
       "\[IndentingNewLine]", 
      RowBox[{"optionlist", ":=", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
         "Global`Device", ",", "Global`MinValue", ",", "Global`MaxValue", ",",
           "Global`Units", ",", "Global`ClockSource", ",", 
          "Global`ActiveEdge", ",", "Global`TransferMechanism", ",", 
          "Global`SampleMode", ",", "Global`TimeOut", ",", 
          "Global`MessageLevel", ",", "Global`SetupOnly"}], "}"}], "/.", 
        RowBox[{"Flatten", "[", 
         RowBox[{"{", 
          RowBox[{"opts", ",", 
           RowBox[{"Options", "[", "OutputWaveform", "]"}]}], "}"}], 
         "]"}]}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"golocal", "=", 
       RowBox[{"{", 
        RowBox[{
        "device", ",", "minvalue", ",", "maxvalue", ",", "units", ",", 
         "clocksource", ",", "activeedge", ",", "transfermechanism", ",", 
         "samplemode", ",", "timeout", ",", "messagelevel", ",", 
         "setuponly"}], "}"}]}], ";", "\[IndentingNewLine]", 
      RowBox[{"Apply", "[", 
       RowBox[{"Set", ",", 
        RowBox[{"Transpose", "[", 
         RowBox[{"{", 
          RowBox[{"golocal", ",", "optionlist"}], "}"}], "]"}], ",", "1"}], 
       "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
      RowBox[{"outwaveflag", "=", "1"}], ";", "\[IndentingNewLine]", 
      "argumenttests", ";", "\[IndentingNewLine]", "optiontests", ";", 
      "\[IndentingNewLine]", "setconstants", ";", "\[IndentingNewLine]", 
      "getnumberofchannels", ";", "\[IndentingNewLine]", 
      "getoutputdevicestring", ";", "\[IndentingNewLine]", 
      "\[IndentingNewLine]", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{"numberofchannels", "===", "1"}], ",", 
        RowBox[{
         RowBox[{"samples", "=", 
          RowBox[{"Length", "[", "wave", "]"}]}], ";", 
         RowBox[{"newwave", "=", "wave"}], ";"}], ",", "Null"}], "]"}], ";", 
      "\[IndentingNewLine]", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{
         RowBox[{"numberofchannels", "===", "2"}], "&&", 
         RowBox[{
          RowBox[{"Depth", "[", 
           RowBox[{"wave", "//", "N"}], "]"}], "===", "2"}]}], ",", 
        RowBox[{
         RowBox[{"samples", "=", 
          RowBox[{"Length", "[", "wave", "]"}]}], ";", 
         RowBox[{"newwave", "=", 
          RowBox[{"Join", "[", 
           RowBox[{"wave", ",", "wave"}], "]"}]}], ";"}], ",", "Null"}], 
       "]"}], ";", "\[IndentingNewLine]", 
      RowBox[{"If", "[", 
       RowBox[{
        RowBox[{
         RowBox[{"numberofchannels", "===", "2"}], "&&", 
         RowBox[{
          RowBox[{"Depth", "[", 
           RowBox[{"wave", "//", "N"}], "]"}], "===", "3"}]}], ",", 
        RowBox[{
         RowBox[{"samples", "=", 
          RowBox[{"Length", "[", 
           RowBox[{"wave", "[", 
            RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ";", 
         RowBox[{"newwave", "=", 
          RowBox[{"Join", "[", 
           RowBox[{
            RowBox[{"wave", "[", 
             RowBox[{"[", "1", "]"}], "]"}], ",", 
            RowBox[{"wave", "[", 
             RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], ";"}], ",", "Null"}], 
       "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
      RowBox[{"listforcall", "=", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{"\"\<channels\>\"", ",", "devicestring"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<numchannels\>\"", ",", "numberofchannels"}], "}"}], 
         ",", 
         RowBox[{"{", 
          RowBox[{"\"\<waveform\>\"", ",", 
           RowBox[{"newwave", "//", "N"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<frequency\>\"", ",", 
           RowBox[{"N", "[", "freq", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<samples\>\"", ",", "samples"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<numperiods\>\"", ",", 
           RowBox[{"N", "[", "periods", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<min\>\"", ",", 
           RowBox[{"N", "[", "minvalue", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<max\>\"", ",", 
           RowBox[{"N", "[", "maxvalue", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<units\>\"", ",", "units"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<transfermech\>\"", ",", "transfermechanism"}], "}"}], 
         ",", 
         RowBox[{"{", 
          RowBox[{"\"\<clock\>\"", ",", 
           RowBox[{"ToString", "[", "clocksource", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<activeedge\>\"", ",", "activeedge"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<samplemode\>\"", ",", "samplemode"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<timeout\>\"", ",", 
           RowBox[{"N", "[", "timeout", "]"}]}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<messagelevel\>\"", ",", "messagelevel"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"\"\<setuponly\>\"", ",", "setupflag"}], "}"}]}], "}"}]}], 
      ";", "\[IndentingNewLine]", 
      RowBox[{"taskhandle", "=", 
       RowBox[{"CheckAbort", "[", 
        RowBox[{
         RowBox[{"Global`OutputWaveformCpp", "[", "listforcall", "]"}], ",", 
         RowBox[{
          RowBox[{"LinkInterrupt", "[", "outputwaveformlink", "]"}], ";", 
          RowBox[{"Goto", "[", "linkabort", "]"}], ";"}]}], "]"}]}], ";", 
      "\[IndentingNewLine]", "\[IndentingNewLine]", "messages", ";", 
      "\[IndentingNewLine]", "clearconstants", ";", "\[IndentingNewLine]", 
      RowBox[{"Return", "[", "taskhandle", "]"}]}], ")"}]}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{
     RowBox[{"OutputWaveform", "[", 
      RowBox[{"arg__", "/;", 
       RowBox[{
        RowBox[{
         RowBox[{"Length", "[", 
          RowBox[{"{", "arg", "}"}], "]"}], "<", "4"}], "||", 
        RowBox[{
         RowBox[{"Length", "[", 
          RowBox[{"{", "arg", "}"}], "]"}], ">", "4"}]}]}], "]"}], ":=", 
     RowBox[{"Message", "[", 
      RowBox[{
       RowBox[{"OutputWaveform", "::", "badarg"}], ",", 
       RowBox[{"{", "arg", "}"}]}], "]"}]}], ";"}], 
   StyleBox["\[IndentingNewLine]",
    FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
   StyleBox[
    RowBox[{"(*", 
     RowBox[{"===", "===", "===", 
      RowBox[{"==", " ", 
       RowBox[{
       "End", " ", "OutputWaveform", " ", "Definition", " ", "Section"}]}], 
      " ", "===", "===", "===", "\[Equal]"}], "*)"}],
    FontColor->RGBColor[1, 0, 0]]}]}]], "Input",
 InitializationCell->True]
}, Open  ]]
}, Open  ]],

Cell[BoxData[
 RowBox[{
  StyleBox[
   RowBox[{"(*", " ", 
    RowBox[{"end", " ", "private"}], " ", "*)"}],
   FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{
    RowBox[{"End", "[", "]"}], ";"}], "\[IndentingNewLine]", 
   "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"Protect", "[", 
     RowBox[{
     "GetVoltages", ",", "GetVoltagesTrig", ",", "GetVoltagesDigTrig", ",", 
      "OutputVoltage", ",", "OutputWaveform", ",", "ReDoLink"}], "]"}], ";"}],
    "\[IndentingNewLine]", "\[IndentingNewLine]", 
   StyleBox[
    RowBox[{"(*", " ", 
     RowBox[{"end", " ", "package"}], " ", "*)"}],
    FontColor->GrayLevel[0]], "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"EndPackage", "[", "]"}], ";"}]}]}]], "Input",
 InitializationCell->True,
 CellChangeTimes->{{3.409451728694378*^9, 3.409451739519944*^9}, {
  3.409452191419744*^9, 3.4094521915299025`*^9}}]
}, Open  ]]
},
AutoGeneratedPackage->Automatic,
WindowToolbars->{},
CellGrouping->Manual,
WindowSize->{944, 655},
WindowMargins->{{Automatic, -971}, {Automatic, -39}},
PrintingCopies->1,
PrintingPageRange->{1, Automatic},
FrontEndVersion->"7.0 for Microsoft Windows (32-bit) (November 10, 2008)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[567, 22, 788, 15, 72, "Input",
 InitializationCell->True],
Cell[CellGroupData[{
Cell[1380, 41, 114, 2, 49, "Subtitle",
 InitializationCell->True],
Cell[1497, 45, 8643, 175, 1132, "Input",
 InitializationCell->True]
}, Closed]],
Cell[10155, 223, 101, 2, 25, "Input",
 InitializationCell->True],
Cell[CellGroupData[{
Cell[10281, 229, 98, 2, 49, "Subtitle",
 InitializationCell->True],
Cell[10382, 233, 2454, 56, 332, "Input",
 InitializationCell->True]
}, Closed]],
Cell[CellGroupData[{
Cell[12873, 294, 105, 2, 49, "Subtitle",
 InitializationCell->True],
Cell[CellGroupData[{
Cell[13003, 300, 91, 1, 28, "Subsubtitle",
 InitializationCell->True],
Cell[13097, 303, 4224, 106, 452, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[17358, 414, 63, 1, 29, "Text",
 InitializationCell->True],
Cell[17424, 417, 2816, 79, 252, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[20277, 501, 72, 1, 29, "Text",
 InitializationCell->True],
Cell[20352, 504, 4242, 117, 392, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[24631, 626, 65, 1, 29, "Text",
 InitializationCell->True],
Cell[24699, 629, 839, 25, 92, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[25575, 659, 85, 1, 29, "Text",
 InitializationCell->True],
Cell[25663, 662, 784, 22, 92, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[26484, 689, 69, 1, 29, "Text",
 InitializationCell->True],
Cell[26556, 692, 773, 23, 72, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[27366, 720, 71, 1, 29, "Text",
 InitializationCell->True],
Cell[27440, 723, 718, 21, 92, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[28195, 749, 64, 1, 29, "Text",
 InitializationCell->True],
Cell[28262, 752, 3711, 104, 312, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[32010, 861, 73, 1, 29, "Text",
 InitializationCell->True],
Cell[32086, 864, 954, 29, 72, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[33077, 898, 60, 1, 29, "Text",
 InitializationCell->True],
Cell[33140, 901, 747, 23, 92, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[33924, 929, 67, 1, 29, "Text",
 InitializationCell->True],
Cell[33994, 932, 1020, 28, 132, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[35051, 965, 76, 1, 29, "Text",
 InitializationCell->True],
Cell[35130, 968, 2019, 56, 232, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[37186, 1029, 59, 1, 29, "Text",
 InitializationCell->True],
Cell[37248, 1032, 1143, 37, 72, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[38428, 1074, 66, 1, 29, "Text",
 InitializationCell->True],
Cell[38497, 1077, 647, 20, 72, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[39181, 1102, 65, 1, 29, "Text",
 InitializationCell->True],
Cell[39249, 1105, 845, 25, 92, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[40131, 1135, 65, 1, 29, "Text",
 InitializationCell->True],
Cell[40199, 1138, 857, 26, 92, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[41093, 1169, 62, 1, 29, "Text",
 InitializationCell->True],
Cell[41158, 1172, 936, 28, 72, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[42131, 1205, 67, 1, 29, "Text",
 InitializationCell->True],
Cell[42201, 1208, 779, 24, 72, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[43017, 1237, 66, 1, 29, "Text",
 InitializationCell->True],
Cell[43086, 1240, 870, 24, 92, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[43993, 1269, 67, 1, 29, "Text",
 InitializationCell->True],
Cell[44063, 1272, 860, 25, 92, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[44960, 1302, 72, 1, 29, "Text",
 InitializationCell->True],
Cell[45035, 1305, 1072, 31, 132, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[46144, 1341, 73, 1, 29, "Text",
 InitializationCell->True],
Cell[46220, 1344, 1376, 37, 212, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[47633, 1386, 64, 1, 29, "Text",
 InitializationCell->True],
Cell[47700, 1389, 880, 26, 92, "Input",
 InitializationCell->True]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[48629, 1421, 118, 2, 49, "Subtitle",
 InitializationCell->True],
Cell[48750, 1425, 15825, 408, 1592, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[64612, 1838, 96, 2, 49, "Subtitle",
 InitializationCell->True],
Cell[64711, 1842, 6737, 168, 652, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[71485, 2015, 105, 2, 49, "Subtitle",
 InitializationCell->True],
Cell[CellGroupData[{
Cell[71615, 2021, 94, 2, 28, "Subsubtitle",
 InitializationCell->True],
Cell[71712, 2025, 6741, 154, 832, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[78490, 2184, 98, 2, 28, "Subsubtitle",
 InitializationCell->True],
Cell[78591, 2188, 8477, 188, 1132, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[87105, 2381, 101, 2, 28, "Subsubtitle",
 InitializationCell->True],
Cell[87209, 2385, 9862, 228, 1052, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[97108, 2618, 96, 2, 28, "Subsubtitle",
 InitializationCell->True],
Cell[97207, 2622, 6528, 159, 712, "Input",
 InitializationCell->True]
}, Open  ]],
Cell[CellGroupData[{
Cell[103772, 2786, 97, 2, 28, "Subsubtitle",
 InitializationCell->True],
Cell[103872, 2790, 7829, 186, 912, "Input",
 InitializationCell->True]
}, Open  ]]
}, Open  ]],
Cell[111728, 2980, 892, 24, 152, "Input",
 InitializationCell->True]
}, Open  ]]
}
]
*)

(* End of internal cache information *)
